Skip to content

Commit b17130a

Browse files
aduh95danielleadams
authored andcommitted
readline: fix behaviour of Interface plugged to a non-terminal output
Fixes: #36773 PR-URL: #36774 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent a7bb4da commit b17130a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/readline.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ function Interface(input, output, completer, terminal) {
274274
input.on('keypress', onkeypress);
275275
input.on('end', ontermend);
276276

277-
// Current line
278-
this.line = '';
279-
280277
this._setRawMode(true);
281278
this.terminal = true;
282279

@@ -292,6 +289,9 @@ function Interface(input, output, completer, terminal) {
292289
self.once('close', onSelfCloseWithTerminal);
293290
}
294291

292+
// Current line
293+
this.line = '';
294+
295295
input.resume();
296296
}
297297

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
const repl = require('repl');
5+
const r = repl.start({ terminal: false });
6+
r.setupHistory('/nonexistent/file', common.mustSucceed());
7+
process.stdin.unref?.();

0 commit comments

Comments
 (0)