gift icon indicating copy to clipboard operation
gift copied to clipboard

Attaching stdout, stderr to error objects

Open deployable opened this issue 9 years ago • 1 comments

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.

deployable avatar Feb 13 '16 07:02 deployable

There's an effort to use child_process.spawn in #38

notatestuser avatar Feb 16 '16 03:02 notatestuser