Skip to content
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: setup stdio on error when possible #27696

Merged
merged 1 commit into from
May 20, 2019
Merged

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented May 14, 2019

As more spawn() errors are classified as runtime errors, it's no longer appropriate to only check UV_ENOENT when determining if stdio can be setup. This commit reverses the check to look for EMFILE and ENFILE specifically.

Fixes: #26852

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added the child_process Issues and PRs related to the child_process subsystem. label May 14, 2019
@Fishrock123
Copy link
Contributor

Is this semver-major?

@cjihrig
Copy link
Contributor Author

cjihrig commented May 14, 2019

It's a breaking change if code relies on stdio streams NOT being configured when spawn fails with UV_EACCES or UV_EAGAIN. My guess is that it's not a breaking change in the real world.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented May 14, 2019

CI: https://ci.nodejs.org/job/node-test-pull-request/23114/

EDIT(cjihrig): CI was yellow.

@cjihrig
Copy link
Contributor Author

cjihrig commented May 16, 2019

Ping for reviews.

@Trott
Copy link
Member

Trott commented May 17, 2019

Optional suggestion: The current condition is covered in tests. Would be great if you could confirm that this is still covered with the change.

@cjihrig
Copy link
Contributor Author

cjihrig commented May 18, 2019

@Trott both branches of the conditional are still covered. I also pushed up some assertions to verify it. We may miss coverage on the ENFILE check, but EMFILE is covered.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

// It's kind of silly that the de facto spec for ENOENT (the test suite)
// mandates that stdio _is_ set up, even if there is no process on the
// receiving end, but it is what it is.
if (err !== UV_ENOENT) return err;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh hey, it's that comment's fifth birthday tomorrow - that's long enough for me to change my mind. :-)

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented May 20, 2019

CI: https://ci.nodejs.org/job/node-test-pull-request/23229/

EDIT(cjihrig): CI was yellow.

As more spawn() errors are classified as runtime errors, it's
no longer appropriate to only check UV_ENOENT when determining
if stdio can be setup. This commit reverses the check to look
for EMFILE and ENFILE specifically.

PR-URL: nodejs#27696
Fixes: nodejs#26852
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@cjihrig cjihrig merged commit 64182e9 into nodejs:master May 20, 2019
@cjihrig cjihrig deleted the 26852 branch May 20, 2019 13:35
BridgeAR pushed a commit that referenced this pull request May 21, 2019
As more spawn() errors are classified as runtime errors, it's
no longer appropriate to only check UV_ENOENT when determining
if stdio can be setup. This commit reverses the check to look
for EMFILE and ENFILE specifically.

PR-URL: #27696
Fixes: #26852
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@BridgeAR BridgeAR mentioned this pull request May 21, 2019
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No error was thrown when spawn command was existed but non-executable
5 participants