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.
Oh the humanity
$ node example.js | headticktickticktickticktickticktickticktickevents.js:66throw arguments; // Unhandled 'error' event^Error: write EPIPEat errnoExceptionat Object.afterWrite
Oh the joy!
$ node example.js | headticktickticktickticktickticktickticktick
CLI usage (Node 4.x and up)
epipebomb/register from the command line
node -r epipebomb/register some-script.js | head
epipebomb as a drop-in replacement for
epipebomb some-script.js | head
EPIPE error is captured on
process.stdout - all other errors are thrown as per usual.