Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debugger: also exit when the repl emits 'exit' #2369

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Ctrl + C
this.repl.rli.on('SIGINT', exitDebugRepl);

// Exit debug repl on '.exit'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments aren't so correct imo. ctrl+c isn't the only way to send a SIGINT to a procees, and exit can also be caused by ctrl+d on an empty repl prompt.

this.repl.on('exit', exitDebugRepl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe prefer 'close'? Does the same thing but I think 'exit' may be an older event we don't use internally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still used in L762, or am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, hmm. Carry on then. Maybe we should switch it eventually.


// Set new
this.repl.eval = this.debugEval.bind(this);
Expand Down