[debugger] display message on repl(), do not display warnings on Ctrl+C
authorFedor Indutny <fedor.indutny@gmail.com>
Wed, 7 Sep 2011 16:43:59 +0000 (23:43 +0700)
committerFedor Indutny <fedor.indutny@gmail.com>
Thu, 8 Sep 2011 19:06:07 +0000 (02:06 +0700)
lib/_debugger.js

index 63dc36a10f367cde1dfd591b1dbd7fe9bb533731..5472fcd0fe0a1ed188194764cc19e432abade2f5 100644 (file)
@@ -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();
   });