-
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: do not extend result for *Sync() #13601
Conversation
I agree that it is unexpected. It looks like this was the behavior going all the way back to at least 0.12.0. The tests referenced in this PR are all newer than that, so I'm not sure that the two things are related. @bnoordhuis or @sam-github do either of you know why the inputs were originally attached to the output? |
@@ -52,16 +53,18 @@ assert.strictEqual(env.stdout.toString().trim(), 'buzz'); | |||
const shellFlags = platform === 'win32' ? ['/d', '/s', '/c'] : ['-c']; |
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.
tiny nit: common.isWindows
...
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.
I don't think it really matters much since we're already explicitly passing 'win32'
to this function below here.
a19761a
to
14f88fe
Compare
Forgot to re-add a removed test. New CI: https://ci.nodejs.org/job/node-test-pull-request/8594/ |
/cc @nodejs/ctc |
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.
LGTM
14f88fe
to
1ed6ece
Compare
Sorry, I don't know why they were added. Getting rid of them seems like a good idea. |
CITGM clean |
PR-URL: nodejs#13601 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1ed6ece
to
448c4c6
Compare
In PR [1], a bunch of properties were removed from the error thrown by execSync and execFileSync. It turns out that some of those were still supposed to be there, as the documentation states that the error contains the entire result from the spawnSync call. [1] nodejs#13601
In PR [1], a bunch of properties were removed from the error thrown by execSync and execFileSync. It turns out that some of those were still supposed to be there, as the documentation states that the error contains the entire result from the spawnSync call. [1] #13601 PR-URL: #16060 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
In PR [1], a bunch of properties were removed from the error thrown by execSync and execFileSync. It turns out that some of those were still supposed to be there, as the documentation states that the error contains the entire result from the spawnSync call. [1] nodejs/node#13601 PR-URL: nodejs/node#16060 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
In PR [1], a bunch of properties were removed from the error thrown by execSync and execFileSync. It turns out that some of those were still supposed to be there, as the documentation states that the error contains the entire result from the spawnSync call. [1] nodejs/node#13601 PR-URL: nodejs/node#16060 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
It appears that when the synchronous
child_process
methods were added, additional information such as user-provided/parsed options, etc. was being copied to the returned object. Not only is this undocumented/unexpected, but it looks like this may have only been done for the purposes of tests (to test normalized/default options for example).This PR extracts the actual sync spawning into an internal function which can then be monkey-patched as needed by tests.
I have also changed the errors returned by the
exec*Sync()
methods so that it matches that of theError
object mutation done for the asyncexec*()
methods (e.g.err.result
contains the libuv error name for status codes less than 0).CI: https://ci.nodejs.org/job/node-test-pull-request/8593/
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)