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

@ -10,6 +10,7 @@
### Fixed
- Fixed unnecessary full redraws when appending many lines after content had previously shrunk (viewport check now uses actual previous content size instead of stale maximum)
- Fixed Ctrl+D exit closing the parent SSH session due to stdin buffer race condition ([#1185](https://github.com/badlogic/pi-mono/issues/1185))
## [0.51.0] - 2026-02-01

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);