You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
spawn's stdio can result in stderr being closed in child #862
var cp = require('child_process');
var fs = require('fs');
if (process.env.CHILD) {
console.error('ERROR');
return;
}
// open child stdout and stderr on our stderr
var options = {
stdio: [0, 2, 2],
env: { CHILD: true },
};
var c = cp.spawn(process.execPath, [__filename], options);
I think this asks for a two-pronged approach: libuv probably has a bug or two that need to be addressed but io.js could reopen fds 0-2 as /dev/null if they aren't valid file descriptors.
Opening fd 2 on /dev/null would avoid the EBADF, and probably is a good idea, so fd 2 doesn't become some random open file, but wouldn't avoid the underlying problem, that console.error() never prints, because stderr is gone.
@saghulhttps://github.com/saghul I think I've fixed this, as well as
some related bugs. I'm putting together some node tests, then I'll PR the
fix to libuv.
—
Reply to this email directly or view it on GitHub #862 (comment).
Activity
saghul commentedon Feb 17, 2015
I believe that's still not fixed. This is the closest open issue I could find: joyent/libuv#923
bnoordhuis commentedon Feb 17, 2015
I think this asks for a two-pronged approach: libuv probably has a bug or two that need to be addressed but io.js could reopen fds 0-2 as /dev/null if they aren't valid file descriptors.
vkurchatkin commentedon Feb 17, 2015
@bnoordhuis can you also comment on #831 ?
sam-github commentedon Feb 18, 2015
Opening fd 2 on /dev/null would avoid the EBADF, and probably is a good idea, so fd 2 doesn't become some random open file, but wouldn't avoid the underlying problem, that
console.error()never prints, because stderr is gone.I dug up the last time I saw this:
test: do not trigger node bug with fd mapping
sam-github commentedon Feb 24, 2015
@saghul I think I've fixed this, as well as some related bugs. I'm putting together some node tests, then I'll PR the fix to libuv.
saghul commentedon Feb 24, 2015
Great! Thanks Sam.
On Feb 24, 2015 6:57 PM, "Sam Roberts" notifications@github.com wrote:
unix: don't close the fds we just setup
unix: don't close the fds we just setup
unix: don't close the fds we just setup
unix: don't close the fds we just setup
deps: update libuv to 1.5.0
bnoordhuis commentedon May 6, 2015
Should be fixed by 04cc03b. Closing, holler if I should reopen it.
deps: update libuv to 1.5.0
leth commentedon Sep 7, 2016
I'm seeing a failure like this frequently from
npm installunder node 6.4.0.