-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
doc: script with space spawn example for windows #8035
Conversation
Adds an example of how to spawn a shell script under Windows with spaces in its filename. Ref: nodejs#7367
-1. This is basic escaping on Windows. Imo, anyone targeting the platform knows this. |
@eljefedelrodeodeljefe Yeah, was just replying… ;) I would say that I am a counterexample myself… Windows |
In any case, 8 lines in the docs don’t seem like an unreasonably high cost for helping to explain something that comes up on the issue tracker here every few months (if I’m thinking of the right kind of issues)… |
Yeah. Fair point. No strong opinion, still I don't see the need. Wouldn't mind if this goes forward. |
// Script with spaces in the filename: | ||
const bat = spawn('"my script.cmd"', ['a', 'b'], { shell:true }); | ||
// or: | ||
exec('"my script.cmd" a b', (err, stdout, stderr) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just for my own understading… these two variants won’t be distinguishable, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they won't. Final Winapi call will have the same parameter (something like cmd.exe /s /k ""my script.cmd" a b"
)
I agree with @addaleax , this provides some help with very little cost. The referenced issue proves that this is not obvious for some users. LGTM |
@nodejs/documentation @nodejs/platform-windows any suggestions? I'll land this next week if there are no objections. |
LGTM. In my view, more examples are almost always a good thing and we have had questions on this before. |
Btw, if we want to be more careful about not overloading the documentation pages with unnecessary examples or notes, we can always start using the HTML5 |
Checklist
Affected core subsystem(s)
doc
Description of change
Adds an example of how to spawn a shell script under Windows with spaces in its filename.
Ref: #7367
cc @nodejs/documentation