crabot 0.1.1 → 0.1.2
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/crabot.mjs +13 -1
- package/package.json +1 -1
package/bin/crabot.mjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// runtime is embedded) downloaded from the matching GitHub release by the postinstall hook, or
|
|
4
4
|
// lazily here on first run if that was skipped. No Bun or Node runtime is required to run crabot.
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
6
7
|
import { ensureBinary } from "../scripts/install.mjs";
|
|
7
8
|
|
|
8
9
|
let binaryPath;
|
|
@@ -13,7 +14,18 @@ try {
|
|
|
13
14
|
process.exit(1);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
// The downloaded binary lives at a version-pinned cache path that `npm update` orphans, so its own
|
|
18
|
+
// process.execPath is not a stable launch target. Expose the stable command that re-launches crabot —
|
|
19
|
+
// this launcher under Node, which re-resolves the matching binary on demand — so `crabot service
|
|
20
|
+
// install` writes a service unit that survives upgrades. This launcher path is stable across upgrades
|
|
21
|
+
// (npm replaces the package in place).
|
|
22
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
23
|
+
stdio: "inherit",
|
|
24
|
+
env: {
|
|
25
|
+
...process.env,
|
|
26
|
+
CRABOT_LAUNCH_VECTOR: JSON.stringify([process.execPath, fileURLToPath(import.meta.url)])
|
|
27
|
+
}
|
|
28
|
+
});
|
|
17
29
|
|
|
18
30
|
// Forward termination signals so `crabot serve` shuts the gateway down gracefully when a process
|
|
19
31
|
// manager signals this wrapper. Unsupported signal names throw on registration; ignore those.
|