fix(tui): pause stdin before restoring raw mode to prevent SSH session close

Fixes #1185
This commit is contained in:
Mario Zechner 2026-02-02 19:24:55 +01:00
parent 111a31e4db
commit f431f62609
2 changed files with 6 additions and 0 deletions

View file

@ -178,6 +178,11 @@ export class ProcessTerminal implements Terminal {
this.resizeHandler = undefined;
}
// Pause stdin to prevent any buffered input (e.g., Ctrl+D) from being
// re-interpreted after raw mode is disabled. This fixes a race condition
// where Ctrl+D could close the parent shell over SSH.
process.stdin.pause();
// Restore raw mode state
if (process.stdin.setRawMode) {
process.stdin.setRawMode(this.wasRaw);