Skip to content

Commit

Permalink
debugger: also exit when the repl emits 'exit'
Browse files Browse the repository at this point in the history
Exit the debug repl when repl emits 'exit'

Refs: nodejs/node-v0.x-archive#5637
Fixes: nodejs/node-v0.x-archive#5631
PR-URL: #2369
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
fb55 authored and Myles Borins committed Dec 29, 2015
1 parent bd8b2f0 commit d10b710
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit d10b710

Please sign in to comment.