joyent/node — Issue #2816: util.pump uncatchable error
Author: dready92
Created: 2012-02-23 17:39:37+00:00
State: open

Hello,

I spent lots of time hunting a bug in my application. Basically, the problem was that a child process was kill()ed, but the pump utility didn't fire the callback with an associated error.

I found the following line to be the source of my problem:

if (writeStream.write(chunk) === false) readStream.pause();

Here writeStream.write can't throw an error and we can't catch it. Doing thing like:

try { util.pump(...); } catch (e) { .. do something nice }

don't work.

I'm preparing a patch for my own needs, and just would like to know if I missed something before doing a pull request.