Node: child_process.spawn double quotes problem in [args] parameters.

Created on 26 Dec 2016  路  1Comment  路  Source: nodejs/node

  • v7.2.1:
  • 64-bit (Windows 10):
  • child_process:


And I have problem if I use double quotes in child_process.spawn [args] parameters.
Example:

let ps = spawn('ant.bat', ['-propertyfile ', prop1, '-propertyfile ', prop2, '-Dgit.branch='+branch, '-Dinstallfile.suffix="'+prop4+'"'];

As result I got an error in my code, because normalizeSpawnArguments() take all command string in double quotes too. So please try to handle this situation in normalizeSpawnArguments or describe this limitation in the docs.

child_process question

Most helpful comment

@Sergaros try to set the shell option:

let ps = spawn('ant.bat', ['-propertyfile ', prop1, '-propertyfile ', prop2, '-Dgit.branch='+branch, '-Dinstallfile.suffix="'+prop4+'"'], { shell:true });

Relevant docs: https://nodejs.org/dist/v7.2.1/docs/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows

>All comments

@Sergaros try to set the shell option:

let ps = spawn('ant.bat', ['-propertyfile ', prop1, '-propertyfile ', prop2, '-Dgit.branch='+branch, '-Dinstallfile.suffix="'+prop4+'"'], { shell:true });

Relevant docs: https://nodejs.org/dist/v7.2.1/docs/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows

Was this page helpful?
0 / 5 - 0 ratings