diff --git a/.turbo b/.turbo new file mode 120000 index 0000000..0b7d9ca --- /dev/null +++ b/.turbo @@ -0,0 +1 @@ +/home/nathan/sandbox-agent/.turbo \ No newline at end of file diff --git a/node_modules b/node_modules new file mode 120000 index 0000000..501480b --- /dev/null +++ b/node_modules @@ -0,0 +1 @@ +/home/nathan/sandbox-agent/node_modules \ No newline at end of file diff --git a/sdks/gigacode/bin/gigacode b/sdks/gigacode/bin/gigacode index 0fd87cc..c058666 100644 --- a/sdks/gigacode/bin/gigacode +++ b/sdks/gigacode/bin/gigacode @@ -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; diff --git a/target b/target new file mode 120000 index 0000000..3d6ad8c --- /dev/null +++ b/target @@ -0,0 +1 @@ +/home/nathan/sandbox-agent/target \ No newline at end of file