-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to exit REPL via escape codes when TERM=dumb #29111
Comments
I don't think it's unexpected: the terminfo entry for 'dumb' basically says it doesn't support anything except ^G (bel). On the other hand, lib/readline.js has some emulation baked in and teaching it about ^D isn't hard: diff --git a/lib/readline.js b/lib/readline.js
index b741557a4d..1e7047ce1d 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -825,6 +825,9 @@ function _ttyWriteDumb(s, key) {
}
}
+ if (key.ctrl && key.name === 'd')
+ this.close();
+
switch (key.name) {
case 'return': // Carriage return, i.e. \r
this._sawReturnAt = Date.now(); The reason ^C doesn't work is because the first ^C leaves a Lines 633 to 638 in 427e534
|
This change in diff --git a/lib/readline.js b/lib/readline.js
index b741557a4d..0606b63585 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -823,6 +823,8 @@ function _ttyWriteDumb(s, key) {
// This readline instance is finished
this.close();
}
+
+ return;
}
switch (key.name) { And, like Ben mentioned, the code doesn't currently support Control+D. It looks like it was never added in the original PR. |
Control+D would trigger end of stdin stream in most terminal, which has handled by readline. |
This commit adds support for closing a readline interface on Control+D when the terminal is dumb. PR-URL: nodejs#29149 Fixes: nodejs#29111 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
^C
or^D
do not exit the REPL whenTERM=dumb
is set. Is this expected?The text was updated successfully, but these errors were encountered: