Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
readline: support TERM=dumb
When TERM=dumb and .isTTY=true don't use ANSI escape codes and ignore all keys, except 'escape', 'return' and 'ctrl-c'. PR-URL: #26261 Fixes: #26187 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
- Loading branch information
Showing
with
75 additions
and 7 deletions.
- +51 −7 lib/readline.js
- +21 −0 test/pseudo-tty/readline-dumb-tty.js
- +3 −0 test/pseudo-tty/readline-dumb-tty.out
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,21 @@ | ||
| 'use strict'; | ||
| require('../common'); | ||
|
|
||
| process.env.TERM = 'dumb'; | ||
|
|
||
| const readline = require('readline'); | ||
|
|
||
| const rl = readline.createInterface({ | ||
| input: process.stdin, | ||
| output: process.stdout | ||
| }); | ||
|
|
||
| rl.write('text'); | ||
| rl.write(null, { ctrl: true, name: 'u' }); | ||
| rl.write(null, { name: 'return' }); | ||
| rl.write('text'); | ||
| rl.write(null, { name: 'backspace' }); | ||
| rl.write(null, { name: 'escape' }); | ||
| rl.write(null, { name: 'enter' }); | ||
| rl.write('text'); | ||
| rl.write(null, { ctrl: true, name: 'c' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,3 @@ | ||
| text | ||
| text | ||
| text |