gift
gift copied to clipboard
Attaching stdout, stderr to error objects
The stdout
and stderr
that are returned from an exec
error are lost during error handling. The error
itself doesn't always include complete context of the problem.
It would be useful if they could be attached to the error object that is passed back to the callback.
attach_streams_to = ( obj, stdout, stderr )->
obj.stdout = stdout
obj.stderr = stderr
obj
return attach_streams_to( err, stdout, stderr ) if err
I guess the next level is using spawn
rather than exec
and controlling streams and the error completely.
There's an effort to use child_process.spawn
in #38