diff options
author | Nathan Rajlich <nathan@tootallnate.net> | 2012-03-12 17:28:31 -0700 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2012-03-13 19:58:50 +0100 |
commit | 659d449460d84c40fc5b3bf0e23575378d72d312 (patch) | |
tree | e3933d6c439b79a2a983462a25f159bd42bc996b /lib/repl.js | |
parent | 4f63f9f327857a7ebb1021b55d9ed3bf7cf8d817 (diff) | |
download | node-new-659d449460d84c40fc5b3bf0e23575378d72d312.tar.gz |
repl: make REPLServer emit an "exit" event
This can happen when "SIGINT" is processed by the readline interface,
or when the user types ".exit" into the REPL.
Diffstat (limited to 'lib/repl.js')
-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'); } }); |