From 327286dbcdd91b9a6c983cdf307e36ac36acf05d Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Tue, 17 Apr 2012 11:35:11 -0700 Subject: [PATCH] repl: update the `repl` for the new `readline` behavior This fixes the failing REPL tests. --- lib/repl.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 864e08c052..0a81ebc7df 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -175,7 +175,7 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) { rli.setPrompt(self.prompt); - rli.on('end', function() { + rli.on('close', function() { self.emit('exit'); }); @@ -186,8 +186,7 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) { if (!(self.bufferedCommand && self.bufferedCommand.length > 0) && empty) { if (sawSIGINT) { - rli.pause(); - self.emit('exit'); + rli.close(); sawSIGINT = false; return; } @@ -807,8 +806,7 @@ function defineDefaultCommands(repl) { repl.defineCommand('exit', { help: 'Exit the repl', action: function() { - this.rli.pause(); - this.emit('exit'); + this.rli.close(); } });