jerob 1.2.1 → 1.2.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/jerob.js +13 -3
- package/package.json +1 -1
package/bin/jerob.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
|
|
@@ -7,7 +7,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
7
7
|
|
|
8
8
|
// Check Bun is available
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
const check = spawnSync("bun", ["--version"], { stdio: "ignore" });
|
|
11
|
+
if (check.error) throw check.error;
|
|
11
12
|
} catch {
|
|
12
13
|
console.error(
|
|
13
14
|
"\n[jerob] Bun is required but not installed.\n" +
|
|
@@ -20,7 +21,16 @@ try {
|
|
|
20
21
|
|
|
21
22
|
const entry = join(__dirname, "..", "index.ts");
|
|
22
23
|
|
|
23
|
-
execFileSync
|
|
24
|
+
// Use spawnSync instead of execFileSync so non-zero exit codes
|
|
25
|
+
// (e.g. Commander printing help) don't throw an exception
|
|
26
|
+
const result = spawnSync("bun", [entry, ...process.argv.slice(2)], {
|
|
24
27
|
stdio: "inherit",
|
|
25
28
|
cwd: process.cwd(),
|
|
26
29
|
});
|
|
30
|
+
|
|
31
|
+
if (result.error) {
|
|
32
|
+
console.error("[jerob] Failed to start:", result.error.message);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
process.exit(result.status ?? 0);
|