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) {