fix(coding-agent): ignore SIGINT while process is suspended (#1668)

Add a no-op SIGINT handler before sending SIGTSTP in handleCtrlZ().
Remove it on SIGCONT. Prevents Ctrl+C from killing the backgrounded
process.
This commit is contained in:
Aliou Diallo 2026-02-27 13:51:45 +01:00 committed by GitHub
parent 9a0a8d7ccb
commit 0b4dea466d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2612,8 +2612,14 @@ export class InteractiveMode {
}
private handleCtrlZ(): void {
// Ignore SIGINT while suspended so Ctrl+C in the terminal does not
// kill the backgrounded process. The handler is removed on resume.
const ignoreSigint = () => {};
process.on("SIGINT", ignoreSigint);
// Set up handler to restore TUI when resumed
process.once("SIGCONT", () => {
process.removeListener("SIGINT", ignoreSigint);
this.ui.start();
this.ui.requestRender(true);
});