From 22862e34ac3a5faa0462df9afead7703cc195b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20B=C3=B6hm?= <me@feedic.com> Date: Thu, 13 Aug 2015 20:21:30 +0200 Subject: [PATCH] debugger: also exit when the repl emits 'exit' see joyent/node#5637, fixes joyent/node#5631 --- lib/_debugger.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/_debugger.js b/lib/_debugger.js index ed71c668f316b7..a9265d31bbff31 100644 --- a/lib/_debugger.js +++ b/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 Ctrl + C + this.repl.rli.on('SIGINT', exitDebugRepl); + + // Exit debug repl on '.exit' + this.repl.on('exit', exitDebugRepl); // Set new this.repl.eval = this.debugEval.bind(this);