-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: remove shell option before fork #15299
Conversation
This should have a test. #13983 can probably help with that. We should also document the behavior. It might also be better if we can do this without the Windows check. |
I missed the entire test generation section of the contribution doc. First time at this. *Edit: I checked in a test. Thanks for the gentle reminder/nudge. In the spirit of this being my first attempt at a contribution it is about as complex as the actual code change but hopefully sufficient. On to documentation. |
RE: Not doing the platform check - do you want me to just explicitly set it false and document that shell isn't supported for fork? |
@agresnel I think that based on #13983 (comment), that should be fine. Thanks for taking care of this. |
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.
A couple comments. I think you might want to consider something like this for the test:
'use strict';
// Refs: https://github.com/nodejs/node/issues/13983
// This test verifies that the shell option is not supported by fork().
require('../common');
const assert = require('assert');
const cp = require('child_process');
if (process.argv[2] === undefined) {
cp.fork(__filename, ['$foo'], {
shell: true,
env: { foo: 'bar' }
});
} else {
assert.strictEqual(process.argv[2], '$foo');
}
I only tried this test on macOS. You probably need to conditionally use %foo%
instead of $foo
on Windows.
@@ -335,7 +335,7 @@ The `child_process.fork()` method is a special case of | |||
Like [`child_process.spawn()`][], a [`ChildProcess`][] object is returned. The returned | |||
[`ChildProcess`][] will have an additional communication channel built-in that | |||
allows messages to be passed back and forth between the parent and child. See | |||
[`subprocess.send()`][] for details. | |||
[`subprocess.send()`][] for details. |
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.
Extra whitespace change here.
@@ -0,0 +1,29 @@ | |||
// Copyright Joyent, Inc. and other Node contributors. |
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.
New files don't need this copyright header. You can remove it.
const child_process = require('child_process'); | ||
const fixtures = require('../common/fixtures'); | ||
|
||
//As per: https://github.com/nodejs/node/issues/13983 should produce no error output |
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.
Space after //
.
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.
Lines should be wrapped at 80 characters too. make lint
should have caught this.
The PR owner's account appears to have been deleted. @cjihrig if you are interested in this you may want to take their commit and make a new PR from it. |
@Fishrock123 thanks for the heads up. Will do. |
Moved to #15352 |
This commit ensures that spawn()'s shell option is unconditionally set to false when fork() is called. Refs: nodejs#15299 Fixes: nodejs#13983 PR-URL: nodejs#15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This commit verifies that the child_process fork() method does not honor the shell option. Refs: nodejs#15299 PR-URL: nodejs#15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This commit ensures that spawn()'s shell option is unconditionally set to false when fork() is called. Refs: nodejs/node#15299 Fixes: nodejs/node#13983 PR-URL: nodejs/node#15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This commit verifies that the child_process fork() method does not honor the shell option. Refs: nodejs/node#15299 PR-URL: nodejs/node#15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This commit verifies that the child_process fork() method does not honor the shell option. Refs: #15299 PR-URL: #15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This commit ensures that spawn()'s shell option is unconditionally set to false when fork() is called. Refs: #15299 Fixes: #13983 PR-URL: #15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This commit ensures that spawn()'s shell option is unconditionally set to false when fork() is called. Refs: nodejs/node#15299 Fixes: nodejs/node#13983 PR-URL: nodejs/node#15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This commit verifies that the child_process fork() method does not honor the shell option. Refs: nodejs/node#15299 PR-URL: nodejs/node#15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This commit ensures that spawn()'s shell option is unconditionally set to false when fork() is called. Refs: #15299 Fixes: #13983 PR-URL: #15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This commit verifies that the child_process fork() method does not honor the shell option. Refs: #15299 PR-URL: #15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This commit ensures that spawn()'s shell option is unconditionally set to false when fork() is called. Refs: #15299 Fixes: #13983 PR-URL: #15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This commit verifies that the child_process fork() method does not honor the shell option. Refs: #15299 PR-URL: #15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This commit ensures that spawn()'s shell option is unconditionally set to false when fork() is called. Refs: #15299 Fixes: #13983 PR-URL: #15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This commit verifies that the child_process fork() method does not honor the shell option. Refs: #15299 PR-URL: #15352 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]>
Fixes: #13983
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
child_process