You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
child_process.spawnSync() seems to be truncating arguments containing '&' #6702
spawning .bat and .cmd files directly has never been reliable in node and isn't supported. The issue is, as you have experienced, that arguments aren't passed reliably. To spawn a bat file, my recommendation would be to explicitly run cmd.exe with the batch file as an argument. If you use the exec() API it'll work.
the reason that windowsVerbatimArguments isn't the default is that when you pass arguments with spaces ["foo bar", "baz quux"], I'd like the spawned process to see that list of arguments, rather than ["foo", "bar", "baz", "quux"]. With windowsVerbatimArguments on one would get the latter.
Fair enough. I see now that the child process documentation has a section on .bat and .cmd files and recommends using { shell: true }. I guess there is nothing left to do but close the issue.
Activity
bnoordhuis commentedon May 12, 2016
Does it work when you pass
{ windowsVerbatimArguments: true }as the options?jasholl commentedon May 12, 2016
Yes! Thank you!
bnoordhuis commentedon May 12, 2016
@piscisaureus You introduced
windowsVerbatimArgumentsback in 2011 in 567470b. Is there a reason it's not the default on Windows?piscisaureus commentedon May 12, 2016
exec()API it'll work.["foo bar", "baz quux"], I'd like the spawned process to see that list of arguments, rather than["foo", "bar", "baz", "quux"]. WithwindowsVerbatimArgumentson one would get the latter.bnoordhuis commentedon May 12, 2016
Fair enough. I see now that the child process documentation has a section on .bat and .cmd files and recommends using
{ shell: true }. I guess there is nothing left to do but close the issue.