Restore terminal to cooked before suspending

This commit is contained in:
Jared Miller 2026-01-30 07:47:22 -05:00
parent 766ae27fee
commit 364e3d909e
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -181,6 +181,11 @@ async function main() {
process.stdin.on("data", (data: Buffer) => {
// ctrl+z in raw mode - suspend child and self
if (data.length === 1 && data[0] === 0x1a) {
// Restore terminal to cooked mode BEFORE suspending
// This lets the shell work properly while we're stopped
if (process.stdin.isTTY) {
process.stdin.setRawMode(false);
}
if (pty) {
process.kill(pty.pid, "SIGTSTP");
}