Browse Source

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.
v0.9.1-release
Nathan Rajlich 13 years ago
committed by Bert Belder
parent
commit
659d449460
  1. 5
      lib/repl.js

5
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');
}
});

Loading…
Cancel
Save