From aff022bb2e5d9eccd692858a42f17723e4491878 Mon Sep 17 00:00:00 2001 From: Zach Bjornson Date: Tue, 24 May 2016 18:27:45 -0700 Subject: [PATCH] fix(bin): don't ignore SIGINT Ignoring SIGINT can make the process interminable. The emitting node process should instead ignore EPIPE. Reverts #161, Fixes #246 --- bin/bunyan | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/bin/bunyan b/bin/bunyan index 73cf458..eb77913 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -118,9 +118,6 @@ var gUsingConditionOpts = false; var pager = null; var stdout = process.stdout; -// Whether we are reading from stdin. -var readingStdin = false; - //---- support functions @@ -1133,7 +1130,6 @@ function drainStdoutAndExit(code) { * @param callback {Function} `function ()` */ function processStdin(opts, stylize, callback) { - readingStdin = true; var leftover = ''; // Left-over partial line from last chunk. var stdin = process.stdin; stdin.resume(); @@ -1469,16 +1465,7 @@ function cleanupAndExit(code, signal) { //---- mainline -process.on('SIGINT', function () { - /** - * Ignore SIGINT (Ctrl+C) if processing stdin -- we should process - * remaining output from preceding process in the pipeline and - * except *it* to close. - */ - if (!readingStdin) { - cleanupAndExit(1, 'SIGINT'); - } -}); +process.on('SIGINT', function () { cleanupAndExit(1, 'SIGINT'); }); process.on('SIGQUIT', function () { cleanupAndExit(1, 'SIGQUIT'); }); process.on('SIGTERM', function () { cleanupAndExit(1, 'SIGTERM'); }); process.on('SIGHUP', function () { cleanupAndExit(1, 'SIGHUP'); });