-
Notifications
You must be signed in to change notification settings - Fork 30k
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
child_process, win: fix shell spawn with AutoRun #8063
Conversation
Under Windows system can be configured to execute a specific command each time a shell is spawned. Under some conditions this breaks the way node handles shell scripts under windows. This commit adds /d switch to spawn and spawnSync which disables this AutoRun functionality. Fixes: nodejs/node-v0.x-archive#25458
This is a breaking change, if users depend on the AutoRun feature. It is also the only way to fix issues like nodejs/node-v0.x-archive#25458. In that specific configuration, node child_process tests fail. cc @nodejs/platform-windows @nodejs/ctc |
LGTM CI: https://ci.nodejs.org/job/node-test-pull-request/3707/ @nodejs/ctc According to https://github.com/nodejs/node/blob/a1d3a8db50fcbb3fb0639cb1bd8077d2c290a21b/COLLABORATOR_GUIDE.md#accepting-modifications , this has to be reviewed by several members of the CTC. Should this be added to the CTC agenda in this case? This is a breaking change because some users might be relying on AutoRun commands to run before their shell scripts. Such users should be able to add the commands otherwise (e. g. running a batch file with the AutoRun commands and the previously run command). I am not aware of any situation where AutoRun is essential for the shell to function. On the other hand, the motivation for this is that some users are stuck with a AutoRun configuration that they cannot change, as in the referenced issue. Furthermore, module writers have no way to know what is in their users AutoRun, so this might help there as well. |
@joaocgreis Probably no need to put it on the CTC agenda unless one of the following happens:
I'd say leave it off the agenda this week, but if it's stuck on Friday or Monday, add the CTC folks I'm guessing would be the likely ones to take an interest: @bnoordhuis @cjihrig @rvagg |
The code changes themselves LGTM, but I'll defer to the Windows experts. Just out of curiosity, what do other languages do in this situation? |
Python for example uses |
It'd be nice to have an understanding of what people use Intuitively it would seem to me that if you have something set to run each time cmd.exe is run then it should even run when Node invokes it. If you want to get around this behaviour then you could always spawn @bzoz the python problem is unrelated to this PR though isn't it? That's because of the lack of |
@joaocgreis & @bzoz we had a brief discussion @ CTC meeting about this today but with a lack of Windows experts we were unable to make any progress. @joshgav is going to see if he can find an authoritative source in Microsoft to offer an opinion. We have an LGTM from @joaocgreis so we might need him to champion this to the CTC because the default status (sorry, thanks to me repeating my suggestion above and @joshgav making a similar statement) is not enthusiastic. |
Oh, and this can go back on ctc-agenda at any time if a collaborator wants to do that. |
The autorun feature seems to be relatively little used, I'm not aware of any official recommendation to use it or any situation where it is the best solution for a problem that would interfere here. By Googling, it seems the main use for this feature is to run This is only intended to fix nodejs/node-v0.x-archive#25458 (node apparently ignoring the Currently, Python and Rust don't seem to have a way to run batch files without running I believe this PR is a improvement for node, but I can't be sure about all node users out there, so I completely respect if the CTC believes the risk is too great for this fix. |
CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/377/ The code changes LGTM too. |
This is a good point IMHO. For these users the straightforward fix would be this PR. Asking them to somehow edit up their dependencies won't scale. Working on getting an opinion from the command-line team. |
The console team in Windows agreed with adding
So LGTM! /cc @miniksa |
this lgtm given that upstream advice and @joaocgreis' comments @joaocgreis do you want to handle merging this one? |
I think there’s consensus here, so I’m going to land this tomorrow unless somebody else does or objects. |
Landed in b90f3da, with the commit message re-wrapped at 72 columns. |
Under Windows system can be configured to execute a specific command each time a shell is spawned. Under some conditions this breaks the way node handles shell scripts under windows. This commit adds /d switch to spawn and spawnSync which disables this AutoRun functionality. Fixes: nodejs/node-v0.x-archive#25458 PR-URL: #8063 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Josh Gavant <josh.gavant@outlook.com> Reviewed-By: Rod Vagg <rod@vagg.org>
I was out, thanks @addaleax ! |
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
child_process, win
Description of change
Under Windows system can be configured to execute a specific command each time a shell is spawned. Under some conditions this breaks the way node handles shell scripts under windows. This commit adds
/d
switch tospawn
andspawnSync
which disables this AutoRun functionality.Fixes: nodejs/node-v0.x-archive#25458