I think this is the issue Felix Geisendoerfer is reporting: http://groups.google.com/group/nodejs/browse_thread/thread/efbae1ec1e67786c
This requires that onExit() is not called immediately upon receiving a SIGCHLD. There could still be data in the pipez. So, instead just set a flag and invoke the pipe watchers. Sometimes one will not receive an EOF from pipes because the process was killed by a SIGTERM, or something. If SIGCHLD has been recved but we are getting EAGAIN, the pipez need to be closed too.