Skip to content

Commit

Permalink
child_process: handle zero fd in process.stdin
Browse files Browse the repository at this point in the history
When passing `process.stdin` in `stdio` options to
`child_process.spawn`, make sure that its `fd` is getting passed
properly to the C++ internals. It is `0`, so the `stdio.fd || stdio`
check will return `process.stdin`, instead of the number.

Fix: nodejs#2721
  • Loading branch information
indutny committed Sep 7, 2015
1 parent cdfa271 commit 5d1710e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ function _validateStdio(stdio, sync) {
} else if (typeof stdio === 'number' || typeof stdio.fd === 'number') {
acc.push({
type: 'fd',
fd: stdio.fd || stdio
fd: typeof stdio === 'number' ? stdio : stdio.fd
});
} else if (getHandleWrapType(stdio) || getHandleWrapType(stdio.handle) ||
getHandleWrapType(stdio._handle)) {
Expand Down

0 comments on commit 5d1710e

Please sign in to comment.