fix(agent): bound CLI subprocess execution

This commit is contained in:
2026-08-18 17:00:23 +08:00
parent 9aa5a96e60
commit 18e8b25f48
7 changed files with 384 additions and 65 deletions
Vendored Executable
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env node
import { closeSync } from "node:fs";
const command = process.argv[3];
const value = process.argv[4] ?? "";
if (command === "stdout") {
process.stdout.write(value);
process.exit(0);
}
if (command === "stderr") {
process.stderr.write(value);
process.exit(1);
}
if (command === "term") {
process.on("SIGTERM", () => {
setTimeout(() => process.exit(0), 30);
});
setInterval(() => undefined, 1000);
}
if (command === "ignore-term") {
process.on("SIGTERM", () => undefined);
setInterval(() => undefined, 1000);
}
if (command === "closed-stdin") {
closeSync(0);
setInterval(() => undefined, 1000);
}