-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
stdout
includes prompt + command on Windows
#116
Comments
I'll try to have a look when I find some time :). |
FWIW, adding |
Hi @mathiasbynens. I looked into this and I can reproduce the issue with a simple const cp = require('child_process');
childProcess.exec('hello.cmd', (err, stdout) => {
console.log(stdout);
//=> '\r\nC:\\Users\\Sam\\Projects\\test>ECHO Hello World\r\nHello World\r\n'
}); I looked into the options of So not sure how to continue from here. Do you happen to know someone who might know more? Should we open an issue in the Node.js repository? |
I agree this is not strictly an execa bug, but rather a quirk of how Windows/ |
I should note that it’s unclear (to me) if it’s even possible to work around this behavior in a reliable/robust way. |
Alright, I was too fast. I found the reason for this behaviour and also found a solution. To run the So in the background we use Are there any downsides of always turning off echo? Is it ok to do it or can we break some behaviour? |
I guess that would break cases where people rely on the current behavior — but it’s unclear if there are any. The behavior is weird, and relying on it seems even weirder, IMHO. What does @sindresorhus think? |
I'm not really into batch files, but what does I totally agree that it's weird and IMO we should turn it off, if it doesn't have other implications. |
Yes, I think we should include the |
@mathiasbynens version 0.9.0 is released with this fix. Thanks for reporting. |
On this line: https://github.com/GoogleChromeLabs/jsvu/blob/905885652848add5f8fe27bb909057fe777974ab/engines/chakra/test.js#L29
stdout
is equal to:"\r\nC:\\Users\\jsvu>\"C:\\Users\\jsvu/.jsvu/engines/chakra\\chakra.exe\" \"C:\\Users\\jsvu\\AppData\\Local\\Temp\\3a4c2232c333e7ab7da85331c1dfe4e4\" \r\nHi!"
The expected value is only the actual stdout, which is:
"Hi!"
In case it matters, this happens after running a batch script
chakra.cmd
with the following contents:The text was updated successfully, but these errors were encountered: