fix: restore ctrl+c and ctrl+p handling in gigacode

This commit is contained in:
Nathan Flurry 2026-02-06 19:52:47 -08:00
parent 80ce95f886
commit 636181d860
4 changed files with 33 additions and 2 deletions

1
.turbo Symbolic link
View file

@ -0,0 +1 @@
/home/nathan/sandbox-agent/.turbo

1
node_modules Symbolic link
View file

@ -0,0 +1 @@
/home/nathan/sandbox-agent/node_modules

View file

@ -1,5 +1,5 @@
#!/usr/bin/env node
const { execFileSync } = require("child_process");
const { spawn } = require("child_process");
const {
assertExecutable,
formatNonExecutableBinaryMessage,
@ -59,7 +59,35 @@ try {
process.exit(1);
}
execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
const child = spawn(binPath, process.argv.slice(2), {
stdio: "inherit",
});
const forwardSignal = (signal) => {
if (!child.killed) {
child.kill(signal);
}
};
const onSigint = () => forwardSignal("SIGINT");
const onSigterm = () => forwardSignal("SIGTERM");
const onSigquit = () => forwardSignal("SIGQUIT");
process.on("SIGINT", onSigint);
process.on("SIGTERM", onSigterm);
process.on("SIGQUIT", onSigquit);
child.on("exit", (code, signal) => {
process.off("SIGINT", onSigint);
process.off("SIGTERM", onSigterm);
process.off("SIGQUIT", onSigquit);
if (signal) {
process.kill(process.pid, signal);
return;
}
process.exit(code ?? 0);
});
} catch (e) {
if (e.status !== undefined) process.exit(e.status);
throw e;

1
target Symbolic link
View file

@ -0,0 +1 @@
/home/nathan/sandbox-agent/target