diff --git a/lib/readline.js b/lib/readline.js index ffd2aab5517027..6fe456ec313493 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -252,9 +252,6 @@ function Interface(input, output, completer, terminal) { input.on('keypress', onkeypress); input.on('end', ontermend); - // Current line - this.line = ''; - this._setRawMode(true); this.terminal = true; @@ -270,6 +267,9 @@ function Interface(input, output, completer, terminal) { self.once('close', onSelfCloseWithTerminal); } + // Current line + this.line = ''; + input.resume(); } diff --git a/test/parallel/test-repl-no-terminal.js b/test/parallel/test-repl-no-terminal.js new file mode 100644 index 00000000000000..60f97b52e26942 --- /dev/null +++ b/test/parallel/test-repl-no-terminal.js @@ -0,0 +1,7 @@ +'use strict'; +const common = require('../common'); + +const repl = require('repl'); +const r = repl.start({ terminal: false }); +r.setupHistory('/nonexistent/file', common.mustSucceed()); +process.stdin.unref?.();