Basically, in Node 0.6, if you start a child_process with
child_process.spawn, the pipe2 system call was used to create the
pipes between parent and child.
This was changed (I believe) in this commit by indutny:
Now the socketpair call is used to create those fds.
I'm not sure why that choice was made, but it has at least one bad
effect: it breaks the ability to use "/dev/stdin" or "/proc/self/fd/0"
on the child, at least on Linux.
The gist shows a Node program that basically just spawns "cat
/proc/self/fd/0", closes the pipe to the cat, and shows what the cat
outputs. In 0.6.17 cat happily cats the empty stdin and exits 1. In
0.8.8 cat fails to open the /proc/self/fd/0.
The C program in the gist shows that the difference really is just
socketpair vs pipe2. If you run the version with pipe2 the open call
succeeds. Comment out pipe2 and uncomment socketpair, and the open
Was this behavior change intentional?
What benefits are created by switching from pipe2 to socketpair?
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to firstname.lastname@example.org
To unsubscribe from this group, send email to
For more options, visit this group at