From 41a41825f62c8bf428420148b187d78966fc5c7e Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Tue, 20 Sep 2011 17:04:35 +0700 Subject: [PATCH] micro-refactor, use rli.output.write instead of rli.write ('line' event was emitted for those writes) --- lib/repl.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 347f7a0e38f..f50c14b3d7a 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -124,17 +124,19 @@ function REPLServer(prompt, stream, eval) { rli.close(); process.exit(); } - var bareInt = false; + + rli.line = ''; + if (!(self.bufferedCommand && self.bufferedCommand.length > 0) && rli.line.length === 0) { - rli.write('\n(^C again to quit)'); - bareInt = true; + rli.output.write('\n(^C again to quit)\n'); + sawSIGINT = true; + } else { + rli.output.write('\n'); } - rli.line = ''; - rli.write('\n'); + self.bufferedCommand = ''; self.displayPrompt(); - sawSIGINT = bareInt; }); rli.addListener('line', function(cmd) {