-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: add safety checks on stdio access #3799
Conversation
When a child process is spawned, there is no guarantee that stdout and stderr will be created successfully. This commit adds checks before attempting to access the streams.
LGTM |
LGTM |
}); | ||
if (child.stdout) { | ||
if (encoding) | ||
child.stdout.setEncoding(encoding); |
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.
is this a behavior change?
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. I just moved the code up a few lines to avoid another if (child.stdout)
check.
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.
ahhh sorry, missed that.
LGTM |
When a child process is spawned, there is no guarantee that stdout and stderr will be created successfully. This commit adds checks before attempting to access the streams. PR-URL: #3799 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 7b355c5 |
When a child process is spawned, there is no guarantee that stdout and stderr will be created successfully. This commit adds checks before attempting to access the streams. PR-URL: #3799 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When a child process is spawned, there is no guarantee that stdout and stderr will be created successfully. This commit adds checks before attempting to access the streams. PR-URL: #3799 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When a child process is spawned, there is no guarantee that stdout and stderr will be created successfully. This commit adds checks before attempting to access the streams. PR-URL: #3799 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When a child process is spawned, there is no guarantee that stdout and stderr will be created successfully. This commit adds checks before attempting to access the streams. PR-URL: #3799 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When a child process is spawned, there is no guarantee that stdout and stderr will be created successfully. This commit adds checks before attempting to access the streams. PR-URL: #3799 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When a child process is spawned, there is no guarantee that
stdout
andstderr
will be created successfully. This commit adds checks before attempting to access the streams.This is related to #1321. It prevents Node from synchronously throwing
TypeError: Cannot read property 'addListener' of undefined
. Instead, an async error,EAGAIN
is provided to the callback.