Skip to content

Commit

Permalink
Fix #11. Exit cleanly on EPIPE.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Sep 9, 2016
1 parent 0eb2594 commit 50111dd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions output.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
process.stdout.on("error", function(error) {
if (error.code === "EPIPE" || error.errno === "EPIPE") {
process.exit(0);
}
});

module.exports = function(value) {
process.stdout.write(value == null ? "null\n" : JSON.stringify(value) + "\n");
};

0 comments on commit 50111dd

Please sign in to comment.