Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b17130a

Browse filesBrowse files
aduh95danielleadams
authored andcommitted
readline: fix behaviour of Interface plugged to a non-terminal output
Fixes: #36773 PR-URL: #36774 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent a7bb4da commit b17130a
Copy full SHA for b17130a

File tree

Expand file treeCollapse file tree

2 files changed

+10
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-3
lines changed
Open diff view settings
Collapse file

‎lib/readline.js‎

Copy file name to clipboardExpand all lines: lib/readline.js
+3-3Lines changed: 3 additions & 3 deletions
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

Collapse file
+7Lines changed: 7 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.