Browse Source

debugger: also exit when the repl emits 'exit'

Exit the debug repl when repl emits 'exit'

Refs: https://github.com/nodejs/node-v0.x-archive/issues/5637
Fixes: https://github.com/nodejs/node-v0.x-archive/issues/5631
PR-URL: https://github.com/nodejs/node/pull/2369
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
process-exit-stdio-flushing
Felix Böhm 9 years ago
committed by James M Snell
parent
commit
a95eb5c671
  1. 14
      lib/_debugger.js

14
lib/_debugger.js

@ -1546,8 +1546,7 @@ Interface.prototype.repl = function() {
var listeners = this.repl.rli.listeners('SIGINT').slice(0);
this.repl.rli.removeAllListeners('SIGINT');
// Exit debug repl on Ctrl + C
this.repl.rli.once('SIGINT', function() {
function exitDebugRepl() {
// Restore all listeners
process.nextTick(function() {
listeners.forEach(function(listener) {
@ -1557,7 +1556,16 @@ Interface.prototype.repl = function() {
// Exit debug repl
self.exitRepl();
});
self.repl.rli.removeListener('SIGINT', exitDebugRepl);
self.repl.removeListener('exit', exitDebugRepl);
}
// Exit debug repl on SIGINT
this.repl.rli.on('SIGINT', exitDebugRepl);
// Exit debug repl on repl exit
this.repl.on('exit', exitDebugRepl);
// Set new
this.repl.eval = this.debugEval.bind(this);

Loading…
Cancel
Save