Destroy EPIPE errors when stdout runs through a truncated pipe
By default, node throws
EPIPE errors if
process.stdout is being written to and
a user runs it through a pipe that gets closed while the process is still outputting
(eg, the simple case of piping a node app through
This seemed a little overzealous to me, so I wrote this to suppress such errors.
$ node example.js | headticktickticktickticktickticktickticktickevents.js:66throw arguments; // Unhandled 'error' event^Error: write EPIPEat errnoExceptionat Object.afterWrite
$ node example.js | headticktickticktickticktickticktickticktick
EPIPE error is captured on
process.stdout - all other errors are thrown as per usual.