aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/repl.js20
-rw-r--r--test/parallel/test-repl-save-load.js2
-rw-r--r--test/parallel/test-repl.js1
3 files changed, 11 insertions, 12 deletions
diff --git a/lib/repl.js b/lib/repl.js
index 3d0c367918..5db94641a3 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -1479,16 +1479,16 @@ function defineDefaultCommands(repl) {
this.displayPrompt();
}
});
-
- repl.defineCommand('editor', {
- help: 'Enter editor mode',
- action() {
- if (!this.terminal) return;
- _turnOnEditorMode(this);
- this.outputStream.write(
- '// Entering editor mode (^D to finish, ^C to cancel)\n');
- }
- });
+ if (repl.terminal) {
+ repl.defineCommand('editor', {
+ help: 'Enter editor mode',
+ action() {
+ _turnOnEditorMode(this);
+ this.outputStream.write(
+ '// Entering editor mode (^D to finish, ^C to cancel)\n');
+ }
+ });
+ }
}
function regexpEscape(s) {
diff --git a/test/parallel/test-repl-save-load.js b/test/parallel/test-repl-save-load.js
index 7d6f28548f..eff05a3920 100644
--- a/test/parallel/test-repl-save-load.js
+++ b/test/parallel/test-repl-save-load.js
@@ -61,7 +61,7 @@ assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'),
'}'
];
const putIn = new ArrayStream();
- const replServer = repl.start('', putIn);
+ const replServer = repl.start({ terminal: true, stream: putIn });
putIn.run(['.editor']);
putIn.run(cmds);
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js
index 6e3bca24e2..bcaa39f6aa 100644
--- a/test/parallel/test-repl.js
+++ b/test/parallel/test-repl.js
@@ -439,7 +439,6 @@ const errorTests = [
expect: [
/\.break/,
/\.clear/,
- /\.editor/,
/\.exit/,
/\.help/,
/\.load/,