Skip to content

Spaces in path names #19

Open
Open
@dwward

Description

@dwward

Hi, I am using your plugin and it is not handling spaces with path names when running nodejs. I was using the filtered-build mechanism and I am unable to control the double quotes properly. This was causing me a problem in my CI environment which resides under "C:\Program Files...." I was able to work around this by pulling the plugin and making changes to executeScript(...) method. I used the expanded form of CommandLine.

Could something like this be included in a future release? I just joined GitHub about 10 minutes ago and I'm still learning how this all works.

NodeJsRunner.java

  private boolean executeScript(String nodeJsFile, String scriptName, String[] params) throws IOException {
    String optimizeFlag = params[0];
    String targetFile = params[1];

    Map<String, File> substitutionMap = new HashMap<String, File>();
    substitutionMap.put("scriptName",  new File(scriptName));
    substitutionMap.put("targetFile",  new File(targetFile));

    CommandLine cmdLine = new CommandLine(nodeJsFile);
    cmdLine.addArgument("${scriptName}");
    cmdLine.addArgument(optimizeFlag);
    cmdLine.addArgument("${targetFile}");
    cmdLine.setSubstitutionMap(substitutionMap);

    DefaultExecutor executor = new DefaultExecutor();
    try {
      return executor.execute(cmdLine) == 0;
    } catch (ExecuteException e) {
      return e.getExitValue() == 0;
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions