From ff64c6722f03cb442859bb7f1bfef8a3adf09119 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 21 Feb 2019 15:32:08 +0100 Subject: [PATCH] repl: add more information This adds information about how to close the repl. PR-URL: https://github.com/nodejs/node/pull/26240 Reviewed-By: Anna Henningsen Reviewed-By: Anto Aravinth Reviewed-By: Roman Reiss Reviewed-By: Jeremiah Senkpiel --- lib/repl.js | 4 +++- test/parallel/test-repl-editor.js | 2 +- test/parallel/test-repl.js | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 1f89f43c241488..f579c6b18d893e 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -572,7 +572,7 @@ function REPLServer(prompt, sawSIGINT = false; return; } - self.output.write('(To exit, press ^C again or type .exit)\n'); + self.output.write('(To exit, press ^C again or ^D or type .exit)\n'); sawSIGINT = true; } else { sawSIGINT = false; @@ -1430,6 +1430,8 @@ function defineDefaultCommands(repl) { var line = `.${name}${cmd.help ? spaces + cmd.help : ''}\n`; this.outputStream.write(line); } + this.outputStream.write('\nPress ^C to abort current expression, ' + + '^D to exit the repl\n'); this.displayPrompt(); } }); diff --git a/test/parallel/test-repl-editor.js b/test/parallel/test-repl-editor.js index 5afbf2540d8403..dbc59742ac28f9 100644 --- a/test/parallel/test-repl-editor.js +++ b/test/parallel/test-repl-editor.js @@ -45,7 +45,7 @@ function run({ input, output, event, checkTerminalCodes = true }) { const tests = [ { input: '', - output: '\n(To exit, press ^C again or type .exit)', + output: '\n(To exit, press ^C again or ^D or type .exit)', event: { ctrl: true, name: 'c' } }, { diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index a53f4a2833d439..6e3bca24e25932 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -444,6 +444,8 @@ const errorTests = [ /\.help/, /\.load/, /\.save/, + '', + 'Press ^C to abort current expression, ^D to exit the repl', /'thefourtheye'/ ] },