Skip to content

Commit 70cbe4a

Browse files
aduh95targos
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 1521a59 commit 70cbe4a

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
@@ -252,9 +252,6 @@ function Interface(input, output, completer, terminal) {
252252
input.on('keypress', onkeypress);
253253
input.on('end', ontermend);
254254

255-
// Current line
256-
this.line = '';
257-
258255
this._setRawMode(true);
259256
this.terminal = true;
260257

@@ -270,6 +267,9 @@ function Interface(input, output, completer, terminal) {
270267
self.once('close', onSelfCloseWithTerminal);
271268
}
272269

270+
// Current line
271+
this.line = '';
272+
273273
input.resume();
274274
}
275275

+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)