You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to exit REPL via escape codes when TERM=dumb #29111
^C or ^D do not exit the REPL when TERM=dumb is set. Is this expected?
$ TERM=dumb nodeWelcome to Node.js v12.8.0.Type ".help" for more information.
>
[press ^C](To exit, press ^C again or ^D or type .exit)[press ^C]
>
[press ^D]
>
[press ^D]>.exit[finally out of it]
Activity
bnoordhuis commentedon Aug 13, 2019
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:
The reason ^C doesn't work is because the first ^C leaves a
\x03character (the C in ^C) in the command buffer and that trips up this logic:node/lib/repl.js
Lines 633 to 638 in 427e534
cjihrig commentedon Aug 14, 2019
This change in
_ttyWriteDumb()fixes the Control+C issue. I'm not sure if it's correct.And, like Ben mentioned, the code doesn't currently support Control+D. It looks like it was never added in the original PR.
legendecas commentedon Aug 14, 2019
Control+D would trigger end of stdin stream in most terminal, which has handled by readline.
readline: close dumb terminals on Control+C
readline: close dumb terminals on Control+D