diff options
-rw-r--r-- | lib/repl.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/repl.js b/lib/repl.js index 07260611f4..10a135f264 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -140,7 +140,9 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) { rli.on('SIGINT', function() { if (sawSIGINT) { rli.pause(); - process.exit(); + self.emit('exit'); + sawSIGINT = false; + return; } rli.line = ''; @@ -766,6 +768,7 @@ function defineDefaultCommands(repl) { help: 'Exit the repl', action: function() { this.rli.pause(); + this.emit('exit'); } }); |