@anona-labs/anona-compute 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/anona-compute +23 -0
- package/package.json +7 -7
package/bin/anona-compute
CHANGED
|
@@ -33,9 +33,32 @@ try {
|
|
|
33
33
|
process.exit(1);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// The terminal sends Ctrl-C (SIGINT), a closed terminal SIGHUP, and a
|
|
37
|
+
// `kill` of the process group SIGTERM to every process in the foreground
|
|
38
|
+
// group, which includes the child. The child decides what a signal means
|
|
39
|
+
// (`logs -f` stops cleanly with exit 0, `run` deletes its sandbox and prints
|
|
40
|
+
// a summary); this shim must outlive it to pass its exit status on. With no
|
|
41
|
+
// handler, node would die of the signal first and report 130 while the
|
|
42
|
+
// child was still cleaning up.
|
|
43
|
+
const SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
44
|
+
const ignore = () => {};
|
|
45
|
+
for (const sig of SIGNALS) process.on(sig, ignore);
|
|
46
|
+
|
|
36
47
|
const result = spawnSync(target, process.argv.slice(2), { stdio: "inherit" });
|
|
48
|
+
|
|
49
|
+
for (const sig of SIGNALS) process.removeListener(sig, ignore);
|
|
50
|
+
|
|
37
51
|
if (result.error) {
|
|
38
52
|
console.error(result.error.message);
|
|
39
53
|
process.exit(1);
|
|
40
54
|
}
|
|
55
|
+
if (result.signal) {
|
|
56
|
+
// The child was killed by a signal: die of the same one, so the caller's
|
|
57
|
+
// shell sees "killed by SIGINT" (128+n), exactly as without the shim.
|
|
58
|
+
process.kill(process.pid, result.signal);
|
|
59
|
+
// Not every signal is fatal to node (SIGPIPE, SIGWINCH); fall back to
|
|
60
|
+
// the shell convention.
|
|
61
|
+
const os = require("node:os");
|
|
62
|
+
process.exit(128 + (os.constants.signals[result.signal] || 0));
|
|
63
|
+
}
|
|
41
64
|
process.exit(result.status === null ? 1 : result.status);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anona-labs/anona-compute",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Anona Compute CLI and MCP server",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"bin/anona-compute"
|
|
16
16
|
],
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@anona-labs/anona-compute-linux-x64": "0.
|
|
19
|
-
"@anona-labs/anona-compute-linux-arm64": "0.
|
|
20
|
-
"@anona-labs/anona-compute-darwin-x64": "0.
|
|
21
|
-
"@anona-labs/anona-compute-darwin-arm64": "0.
|
|
22
|
-
"@anona-labs/anona-compute-win32-x64": "0.
|
|
23
|
-
"@anona-labs/anona-compute-win32-arm64": "0.
|
|
18
|
+
"@anona-labs/anona-compute-linux-x64": "0.2.0",
|
|
19
|
+
"@anona-labs/anona-compute-linux-arm64": "0.2.0",
|
|
20
|
+
"@anona-labs/anona-compute-darwin-x64": "0.2.0",
|
|
21
|
+
"@anona-labs/anona-compute-darwin-arm64": "0.2.0",
|
|
22
|
+
"@anona-labs/anona-compute-win32-x64": "0.2.0",
|
|
23
|
+
"@anona-labs/anona-compute-win32-arm64": "0.2.0"
|
|
24
24
|
}
|
|
25
25
|
}
|