ender-js/Ender — pull request #90 by rvagg (2011-10-27 10:17:31+00:00)
Title: pass stdout fd (1) to npm.install

I really didn't want to know that intimately how npm works, and I didn't have that much time to spare, but hey, sometimes once you start digging you just can't stop until you figure it out.

This is a fix for Ender running on Node 0.5.10, causing hanging as described in issue #85, on Linux at least.

The culprit is in here: https://github.com/isaacs/npm/blob/master/lib/utils/output.js#L127

Using `outfd: null` causes `outfd` to end up as `0` after [nopt](https://github.com/isaacs/nopt) cleans it up. This then ends up in in the `default` of that `switch` in output.js with `stream = new net.Stream(fd)`. **But**, I don't know why this is a problem, I'm suspecting that in 0.5.x we're ending up with something like an additional wrapper around stdout that isn't properly cleaned up. Or perhaps 0.5.x is just more strict in requiring the closing of streams that you create yourself?

I'm assuming here that the desired behaviour for Ender is to have npm prettyprint the package install information to stdout, because that's what it's doing?

Tested against Node 0.5.10 and 0.4.9 on Linux only, my Mac VM is a little broken at the moment and there's enough of you Mac types to test out there.