Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-05-14 19:38:14 +0300
committercjihrig <cjihrig@gmail.com>2019-05-20 16:33:10 +0300
commit64182e95e2e156a9b1ad7295b9657f2f69002cd1 (patch)
tree467aa04b23668ae240c6c5305d03cf02c539aa00 /lib/internal/child_process.js
parent9f71dbc33466f26f3fa9a797ace8aa1f285cb890 (diff)
child_process: setup stdio on error when possible
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: https://github.com/nodejs/node/pull/27696 Fixes: https://github.com/nodejs/node/issues/26852 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib/internal/child_process.js')
-rw-r--r--lib/internal/child_process.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js
index 4e6a25a8a3e..a0f083d8deb 100644
--- a/lib/internal/child_process.js
+++ b/lib/internal/child_process.js
@@ -375,12 +375,11 @@ ChildProcess.prototype.spawn = function(options) {
err === UV_ENFILE ||
err === UV_ENOENT) {
process.nextTick(onErrorNT, this, err);
+
// There is no point in continuing when we've hit EMFILE or ENFILE
// because we won't be able to set up the stdio file descriptors.
- // 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;
+ if (err === UV_EMFILE || err === UV_ENFILE)
+ return err;
} else if (err) {
// Close all opened fds on error
for (i = 0; i < stdio.length; i++) {