parent
26a8bb02a4
commit
e899ecbf92
1 changed files with 7 additions and 0 deletions
|
@ -99,6 +99,8 @@ var gOptsForUncaughtException;
|
||||||
var pager = null;
|
var pager = null;
|
||||||
var stdout = process.stdout;
|
var stdout = process.stdout;
|
||||||
|
|
||||||
|
// Whether we are reading from stdin.
|
||||||
|
var readingStdin = false;
|
||||||
|
|
||||||
|
|
||||||
//---- support functions
|
//---- support functions
|
||||||
|
@ -1050,6 +1052,7 @@ function drainStdoutAndExit(code) {
|
||||||
* @param callback {Function} `function ()`
|
* @param callback {Function} `function ()`
|
||||||
*/
|
*/
|
||||||
function processStdin(opts, stylize, callback) {
|
function processStdin(opts, stylize, callback) {
|
||||||
|
readingStdin = true
|
||||||
var leftover = ''; // Left-over partial line from last chunk.
|
var leftover = ''; // Left-over partial line from last chunk.
|
||||||
var stdin = process.stdin;
|
var stdin = process.stdin;
|
||||||
stdin.resume();
|
stdin.resume();
|
||||||
|
@ -1349,6 +1352,10 @@ function asyncForEach(arr, iterator, callback) {
|
||||||
*/
|
*/
|
||||||
var cleanedUp = false;
|
var cleanedUp = false;
|
||||||
function cleanupAndExit(code, signal) {
|
function cleanupAndExit(code, signal) {
|
||||||
|
// Do not exit if reading form stdin and we get a SIGINT (ctrl-c)
|
||||||
|
if (readingStdin && signal === 'SIGINT') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Guard one call.
|
// Guard one call.
|
||||||
if (cleanedUp) {
|
if (cleanedUp) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue