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 <anna@addaleax.net>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
Ruben Bridgewater 2019-02-21 15:32:08 +01:00 committed by Daniel Bevenius
parent 8a273f1fd5
commit ff64c6722f
3 changed files with 6 additions and 2 deletions

View File

@ -572,7 +572,7 @@ function REPLServer(prompt,
sawSIGINT = false; sawSIGINT = false;
return; 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; sawSIGINT = true;
} else { } else {
sawSIGINT = false; sawSIGINT = false;
@ -1430,6 +1430,8 @@ function defineDefaultCommands(repl) {
var line = `.${name}${cmd.help ? spaces + cmd.help : ''}\n`; var line = `.${name}${cmd.help ? spaces + cmd.help : ''}\n`;
this.outputStream.write(line); this.outputStream.write(line);
} }
this.outputStream.write('\nPress ^C to abort current expression, ' +
'^D to exit the repl\n');
this.displayPrompt(); this.displayPrompt();
} }
}); });

View File

@ -45,7 +45,7 @@ function run({ input, output, event, checkTerminalCodes = true }) {
const tests = [ const tests = [
{ {
input: '', 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' } event: { ctrl: true, name: 'c' }
}, },
{ {

View File

@ -444,6 +444,8 @@ const errorTests = [
/\.help/, /\.help/,
/\.load/, /\.load/,
/\.save/, /\.save/,
'',
'Press ^C to abort current expression, ^D to exit the repl',
/'thefourtheye'/ /'thefourtheye'/
] ]
}, },