Skip to content

Commit a95eb5c

Browse files
fb55jasnell
authored andcommitted
debugger: also exit when the repl emits 'exit'
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 <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent cd1123a commit a95eb5c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/_debugger.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -1546,8 +1546,7 @@ Interface.prototype.repl = function() {
15461546
var listeners = this.repl.rli.listeners('SIGINT').slice(0);
15471547
this.repl.rli.removeAllListeners('SIGINT');
15481548

1549-
// Exit debug repl on Ctrl + C
1550-
this.repl.rli.once('SIGINT', function() {
1549+
function exitDebugRepl() {
15511550
// Restore all listeners
15521551
process.nextTick(function() {
15531552
listeners.forEach(function(listener) {
@@ -1557,7 +1556,16 @@ Interface.prototype.repl = function() {
15571556

15581557
// Exit debug repl
15591558
self.exitRepl();
1560-
});
1559+
1560+
self.repl.rli.removeListener('SIGINT', exitDebugRepl);
1561+
self.repl.removeListener('exit', exitDebugRepl);
1562+
}
1563+
1564+
// Exit debug repl on SIGINT
1565+
this.repl.rli.on('SIGINT', exitDebugRepl);
1566+
1567+
// Exit debug repl on repl exit
1568+
this.repl.on('exit', exitDebugRepl);
15611569

15621570
// Set new
15631571
this.repl.eval = this.debugEval.bind(this);

0 commit comments

Comments
 (0)