Skip to content

Commit aff022b

Browse files
zbjornsontrentm
authored andcommittedMar 21, 2017
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
1 parent f4fff7b commit aff022b

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed
 

‎bin/bunyan

+1-14
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ var gUsingConditionOpts = false;
118118
var pager = null;
119119
var stdout = process.stdout;
120120

121-
// Whether we are reading from stdin.
122-
var readingStdin = false;
123-
124121

125122

126123
//---- support functions
@@ -1133,7 +1130,6 @@ function drainStdoutAndExit(code) {
11331130
* @param callback {Function} `function ()`
11341131
*/
11351132
function processStdin(opts, stylize, callback) {
1136-
readingStdin = true;
11371133
var leftover = ''; // Left-over partial line from last chunk.
11381134
var stdin = process.stdin;
11391135
stdin.resume();
@@ -1469,16 +1465,7 @@ function cleanupAndExit(code, signal) {
14691465

14701466
//---- mainline
14711467

1472-
process.on('SIGINT', function () {
1473-
/**
1474-
* Ignore SIGINT (Ctrl+C) if processing stdin -- we should process
1475-
* remaining output from preceding process in the pipeline and
1476-
* except *it* to close.
1477-
*/
1478-
if (!readingStdin) {
1479-
cleanupAndExit(1, 'SIGINT');
1480-
}
1481-
});
1468+
process.on('SIGINT', function () { cleanupAndExit(1, 'SIGINT'); });
14821469
process.on('SIGQUIT', function () { cleanupAndExit(1, 'SIGQUIT'); });
14831470
process.on('SIGTERM', function () { cleanupAndExit(1, 'SIGTERM'); });
14841471
process.on('SIGHUP', function () { cleanupAndExit(1, 'SIGHUP'); });

0 commit comments

Comments
 (0)
Please sign in to comment.