diff --git a/src/process_wrap.cc b/src/process_wrap.cc index adf1606591f156..90e061f4743d1a 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -98,7 +98,7 @@ class ProcessWrap : public HandleWrap { options->stdio[i].data.stream = stream; } else { Local fd_key = env->fd_string(); - int fd = static_cast(stdio->Get(fd_key)->IntegerValue()); + int fd = static_cast(stdio->Get(fd_key)->Int32Value()); options->stdio[i].flags = UV_INHERIT_FD; options->stdio[i].data.fd = fd; } diff --git a/test/parallel/test-child-process-stdio.js b/test/parallel/test-child-process-stdio.js index 1ff6e4d914f7ec..eab508e7fe559c 100644 --- a/test/parallel/test-child-process-stdio.js +++ b/test/parallel/test-child-process-stdio.js @@ -18,3 +18,8 @@ assert.equal(child.stderr, null); options = {stdio: 'ignore'}; child = common.spawnSyncCat(options); assert.deepEqual(options, {stdio: 'ignore'}); + +// This should never cause segmentation faults +// cf. https://github.com/nodejs/node/issues/2721 +options = {stdio: [process.stdin, process.stdout, process.stderr]}; +child = common.spawnPwd(options);