mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-20 18:02:18 +00:00
fix: restore ctrl+c and ctrl+p handling in gigacode
This commit is contained in:
parent
80ce95f886
commit
636181d860
4 changed files with 33 additions and 2 deletions
1
.turbo
Symbolic link
1
.turbo
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/home/nathan/sandbox-agent/.turbo
|
||||||
1
node_modules
Symbolic link
1
node_modules
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/home/nathan/sandbox-agent/node_modules
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
const { execFileSync } = require("child_process");
|
const { spawn } = require("child_process");
|
||||||
const {
|
const {
|
||||||
assertExecutable,
|
assertExecutable,
|
||||||
formatNonExecutableBinaryMessage,
|
formatNonExecutableBinaryMessage,
|
||||||
|
|
@ -59,7 +59,35 @@ try {
|
||||||
process.exit(1);
|
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) {
|
} catch (e) {
|
||||||
if (e.status !== undefined) process.exit(e.status);
|
if (e.status !== undefined) process.exit(e.status);
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
||||||
1
target
Symbolic link
1
target
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/home/nathan/sandbox-agent/target
|
||||||
Loading…
Add table
Add a link
Reference in a new issue