Restore terminal to cooked before suspending
This commit is contained in:
parent
766ae27fee
commit
364e3d909e
1 changed files with 5 additions and 0 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue