From 00343a9af02d1686eefd16bcfa97d47468f2dd6f Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Wed, 7 Sep 2011 23:43:59 +0700 Subject: [PATCH] [debugger] display message on repl(), do not display warnings on Ctrl+C --- lib/_debugger.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/_debugger.js b/lib/_debugger.js index 63dc36a10f3..5472fcd0fe0 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -1009,8 +1009,22 @@ Interface.prototype.repl = function() { var self = this; + console.log('Press Ctrl + C to leave debug repl'); + + // Don't display any default messages + var listeners = this.repl.rli.listeners('SIGINT'); + this.repl.rli.removeAllListeners('SIGINT'); + // Exit debug repl on Ctrl + C this.repl.rli.once('SIGINT', function() { + // Restore all listeners + process.nextTick(function() { + listeners.forEach(function(listener) { + self.repl.rli.on('SIGINT', listener); + }); + }); + + // Exit debug repl self.exitRepl(); });