Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

childProcess.spawn escaping quotes on windows #61

Open
zzzzBov opened this issue Oct 12, 2018 · 1 comment
Open

childProcess.spawn escaping quotes on windows #61

zzzzBov opened this issue Oct 12, 2018 · 1 comment

Comments

@zzzzBov
Copy link

zzzzBov commented Oct 12, 2018

when a command such as chokidar *.* --initial -c "echo ""Hello World!""" is executed on windows, the output is

\"Hello World!\"

rather than the expected

"Hello World!"

This appears to be caused by some weird default behavior of childProcess.spawn when windowsVerbatimArguments is not set to true.

The quick fix is to just add the option to utils.js

child = childProcess.spawn(SHELL_PATH, [EXECUTE_OPTION, cmd], {
  cwd: opts.cwd,
  stdio: opts.pipe ? 'inherit' : null,
  windowsVerbatimArguments: true
});

however child_process.spawn now has a shell option that looks like it would simplify things here:

child = childProcess.spawn(cmd, {
  cwd: opts.cwd,
  stdio: opts.pipe ? 'inherit' : null,
  shell: true
})
@XhmikosR
Copy link
Contributor

Yup, I was actually experimenting with this myself because otherwise tests do fail on Windows (with git bash). See kimmobrunfeldt/chokidar-cli@master...XhmikosR:test-win

Which would also fix #62.

But then I couldn't make tests pass without setting pipe: true in tests.

We need to add cross-platform CI testing for sure, and look into switching to shell ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants