From 74d3935348adf27aa22e3cfecacd07fca9da5f78 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Tue, 18 Dec 2012 16:34:40 -0800 Subject: [PATCH] exit on EPIPE to avoid useless work --- CHANGES.md | 3 ++- bin/bunyan | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index b55b26b..1d86474 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,7 +8,8 @@ Known issues: ## bunyan 0.16.9 (not yet released) -(nothing yet) +- *Exit* on EPIPE, otherwise we sit there useless processing a huge log file + with, e.g. `bunyan huge.log | head`. ## bunyan 0.16.8 diff --git a/bin/bunyan b/bin/bunyan index 762e24c..47e045e 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -910,6 +910,7 @@ function emit(s) { process.stdout.on("error", function (err) { if (err.code === "EPIPE") { // Pass. See . + drainStdoutAndExit(0); } else { warn(err); drainStdoutAndExit(1);