GeezerVison is showing github.com — readline: fix behaviour of Interface plugged to a non-terminal output · nodejs/node@b17130a
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/readline.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -274,9 +274,6 @@ function Interface(input, output, completer, terminal) { |
274 | 274 | input.on('keypress', onkeypress); |
275 | 275 | input.on('end', ontermend); |
276 | 276 |
|
277 | | - // Current line |
278 | | - this.line = ''; |
279 | | - |
280 | 277 | this._setRawMode(true); |
281 | 278 | this.terminal = true; |
282 | 279 |
|
@@ -292,6 +289,9 @@ function Interface(input, output, completer, terminal) { |
292 | 289 | self.once('close', onSelfCloseWithTerminal); |
293 | 290 | } |
294 | 291 |
|
| 292 | + // Current line |
| 293 | + this.line = ''; |
| 294 | + |
295 | 295 | input.resume(); |
296 | 296 | } |
297 | 297 |
|
|
Collapse file
Copy file name to clipboard +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 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?.(); |