@tablation/crew 0.169.1 → 0.169.3
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/dist/cli.js +83 -46
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6200,6 +6200,46 @@ import {
|
|
|
6200
6200
|
} from "fs";
|
|
6201
6201
|
import { tmpdir as tmpdir2 } from "os";
|
|
6202
6202
|
import { dirname as dirname10, basename as basename5, join as join20 } from "path";
|
|
6203
|
+
|
|
6204
|
+
// src/sleep-sync.ts
|
|
6205
|
+
import { spawnSync as spawnSync6 } from "child_process";
|
|
6206
|
+
function sleepSync(ms3) {
|
|
6207
|
+
if (!(ms3 > 0)) return;
|
|
6208
|
+
if (typeof SharedArrayBuffer !== "undefined") {
|
|
6209
|
+
try {
|
|
6210
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms3);
|
|
6211
|
+
return;
|
|
6212
|
+
} catch {
|
|
6213
|
+
}
|
|
6214
|
+
}
|
|
6215
|
+
const bun = globalThis.Bun;
|
|
6216
|
+
if (typeof bun?.sleepSync === "function") {
|
|
6217
|
+
try {
|
|
6218
|
+
bun.sleepSync(ms3);
|
|
6219
|
+
return;
|
|
6220
|
+
} catch {
|
|
6221
|
+
}
|
|
6222
|
+
}
|
|
6223
|
+
const r = spawnSync6("sleep", [String(ms3 / 1e3)], { stdio: "ignore" });
|
|
6224
|
+
if (r.error) {
|
|
6225
|
+
const end = Date.now() + ms3;
|
|
6226
|
+
while (Date.now() < end) {
|
|
6227
|
+
}
|
|
6228
|
+
}
|
|
6229
|
+
}
|
|
6230
|
+
function sleepSyncCheck(sleep = sleepSync) {
|
|
6231
|
+
const started = Date.now();
|
|
6232
|
+
try {
|
|
6233
|
+
sleep(50);
|
|
6234
|
+
} catch (e) {
|
|
6235
|
+
return { ok: false, message: `sleep-sync failed: ${e instanceof Error ? e.message : String(e)}` };
|
|
6236
|
+
}
|
|
6237
|
+
const took = Date.now() - started;
|
|
6238
|
+
if (took < 40) return { ok: false, message: `sleep-sync returned after ${took} ms, expected about 50` };
|
|
6239
|
+
return { ok: true, message: `sleep-sync ok: ${took} ms` };
|
|
6240
|
+
}
|
|
6241
|
+
|
|
6242
|
+
// src/git.ts
|
|
6203
6243
|
var GitError = class extends Error {
|
|
6204
6244
|
};
|
|
6205
6245
|
function execGit(cwd, args, input) {
|
|
@@ -6713,9 +6753,6 @@ var CHECKOUT_LOCK_STALE_MS = 5 * 60 * 1e3;
|
|
|
6713
6753
|
function checkoutLockPath(dir) {
|
|
6714
6754
|
return `${dir}.sync.lock`;
|
|
6715
6755
|
}
|
|
6716
|
-
function sleepSync(ms3) {
|
|
6717
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms3);
|
|
6718
|
-
}
|
|
6719
6756
|
function acquireCheckoutLock(dir, timeoutMs = 3e4) {
|
|
6720
6757
|
const lockPath = checkoutLockPath(dir);
|
|
6721
6758
|
mkdirSync13(dirname10(lockPath), { recursive: true });
|
|
@@ -7374,7 +7411,7 @@ import { execFile as execFile2 } from "child_process";
|
|
|
7374
7411
|
import { promisify as promisify2 } from "util";
|
|
7375
7412
|
|
|
7376
7413
|
// src/deprovision-host.ts
|
|
7377
|
-
import { spawnSync as
|
|
7414
|
+
import { spawnSync as spawnSync8 } from "child_process";
|
|
7378
7415
|
import { existsSync as existsSync33, readdirSync as readdirSync13 } from "fs";
|
|
7379
7416
|
|
|
7380
7417
|
// src/repo-env.ts
|
|
@@ -7444,7 +7481,7 @@ import { existsSync as existsSync30, readdirSync as readdirSync10, readFileSync
|
|
|
7444
7481
|
import { join as join36 } from "path";
|
|
7445
7482
|
|
|
7446
7483
|
// src/agent.ts
|
|
7447
|
-
import { spawnSync as
|
|
7484
|
+
import { spawnSync as spawnSync7 } from "child_process";
|
|
7448
7485
|
import { readFileSync as readFileSync31, existsSync as existsSync29, statSync as statSync9, mkdirSync as mkdirSync23, writeFileSync as writeFileSync24, createWriteStream, openSync as openSync4, closeSync as closeSync4, readSync } from "fs";
|
|
7449
7486
|
import { StringDecoder } from "string_decoder";
|
|
7450
7487
|
import { finished } from "stream/promises";
|
|
@@ -15508,7 +15545,7 @@ function runIsAlive(sc) {
|
|
|
15508
15545
|
} catch (e) {
|
|
15509
15546
|
if (e.code !== "EPERM") return false;
|
|
15510
15547
|
}
|
|
15511
|
-
const ps =
|
|
15548
|
+
const ps = spawnSync7("ps", ["-o", "lstart=", "-p", String(sc.pid)], { encoding: "utf8" });
|
|
15512
15549
|
const started = Date.parse(ps.stdout.trim());
|
|
15513
15550
|
if (ps.status !== 0 || Number.isNaN(started)) return ps.status === 0;
|
|
15514
15551
|
return Math.abs(started - Date.parse(sc.spawnedAt)) < 15e3;
|
|
@@ -16552,7 +16589,7 @@ var DOCKER_LABEL_OWNER = "crew.owner=crew";
|
|
|
16552
16589
|
var DOCKER_LABEL_CACHE = "crew.kind=cache";
|
|
16553
16590
|
var DOCKER_LABEL_REPO_LAYER = "crew.layer=repo";
|
|
16554
16591
|
function docker(args) {
|
|
16555
|
-
const res =
|
|
16592
|
+
const res = spawnSync8("docker", args, { encoding: "utf8" });
|
|
16556
16593
|
if (res.error || res.status !== 0) throw new Error(`docker ${args[0]} ${args[1] ?? ""} failed: ${(res.stderr || String(res.error ?? "")).trim().split("\n").pop()}`);
|
|
16557
16594
|
return res.stdout;
|
|
16558
16595
|
}
|
|
@@ -17306,7 +17343,7 @@ var imageStoreProblem = (engine = "docker", exec = realExec) => (image) => {
|
|
|
17306
17343
|
};
|
|
17307
17344
|
|
|
17308
17345
|
// src/doctor-checks.ts
|
|
17309
|
-
import { execFileSync as execFileSync11, spawnSync as
|
|
17346
|
+
import { execFileSync as execFileSync11, spawnSync as spawnSync9 } from "child_process";
|
|
17310
17347
|
var PROBE_BRANCH = "crew-probe-branch";
|
|
17311
17348
|
var realGit = (cwd, args, env) => {
|
|
17312
17349
|
execFileSync11("git", args, { cwd, env, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
|
|
@@ -17387,7 +17424,7 @@ function probeCredentialHelper(command2, run4 = realHelperRun) {
|
|
|
17387
17424
|
return { state: "failed", detail: `the git credential helper command does not run: ${why}`, hint: "reinstall crew; git cannot authenticate to a private repository until this works" };
|
|
17388
17425
|
}
|
|
17389
17426
|
var realHelperRun = (cmd, input) => {
|
|
17390
|
-
const r =
|
|
17427
|
+
const r = spawnSync9("sh", ["-c", cmd], { input, encoding: "utf8", timeout: 15e3 });
|
|
17391
17428
|
return { status: r.status, stderr: r.stderr ?? (r.error ? String(r.error) : "") };
|
|
17392
17429
|
};
|
|
17393
17430
|
function formatPushAuth(repo, r) {
|
|
@@ -17457,7 +17494,7 @@ function runtimeDirWarning(platform2, uid, exists, user = "the crew user") {
|
|
|
17457
17494
|
var MANAGED_GIT_EMAIL = "crew@tablation.dev";
|
|
17458
17495
|
function readGlobalGitIdentity() {
|
|
17459
17496
|
const get2 = (key) => {
|
|
17460
|
-
const res =
|
|
17497
|
+
const res = spawnSync9("git", ["config", "--global", "--get", key], { encoding: "utf8" });
|
|
17461
17498
|
const v = (res.stdout ?? "").trim();
|
|
17462
17499
|
return res.status === 0 && v ? v : null;
|
|
17463
17500
|
};
|
|
@@ -17751,7 +17788,7 @@ async function runSelfLaunchCheck(own, spawnFn = spawnChild, launch = selfLaunch
|
|
|
17751
17788
|
import { resolve as resolve7, dirname as dirname38, join as join67, basename as basename17 } from "path";
|
|
17752
17789
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
17753
17790
|
import { hostname as hostname5, homedir as homedir11, userInfo as userInfo2 } from "os";
|
|
17754
|
-
import { spawnSync as
|
|
17791
|
+
import { spawnSync as spawnSync15 } from "child_process";
|
|
17755
17792
|
import { parse as parseYaml3 } from "yaml";
|
|
17756
17793
|
|
|
17757
17794
|
// src/argv.ts
|
|
@@ -18643,7 +18680,7 @@ function matchShipRows(ships, shipName2, machineId) {
|
|
|
18643
18680
|
}
|
|
18644
18681
|
|
|
18645
18682
|
// src/provision.ts
|
|
18646
|
-
import { spawnSync as
|
|
18683
|
+
import { spawnSync as spawnSync10 } from "child_process";
|
|
18647
18684
|
import { existsSync as existsSync37, readFileSync as readFileSync39, writeFileSync as writeFileSync31 } from "fs";
|
|
18648
18685
|
import { hostname as hostname2 } from "os";
|
|
18649
18686
|
import { parseDocument as parseDocument3, isMap as isMap2, isScalar } from "yaml";
|
|
@@ -19277,7 +19314,7 @@ function realProvisionDeps(crewHome) {
|
|
|
19277
19314
|
const env = { ...process.env, ...o.env };
|
|
19278
19315
|
delete env.CREW_FORGE_TOKEN;
|
|
19279
19316
|
for (const k of Object.keys(env)) if (k.startsWith("CREW_CONNECT_KEY_")) delete env[k];
|
|
19280
|
-
const res =
|
|
19317
|
+
const res = spawnSync10(bin, [...pre, ...args], { cwd: crewHome, encoding: "utf8", env, input: o.input, maxBuffer: 64 * 1024 * 1024 });
|
|
19281
19318
|
return { status: res.status ?? 1, stdout: res.stdout ?? "", stderr: `${res.stderr ?? ""}${res.error ? String(res.error) : ""}` };
|
|
19282
19319
|
};
|
|
19283
19320
|
const configFile = () => {
|
|
@@ -19325,15 +19362,15 @@ function realProvisionDeps(crewHome) {
|
|
|
19325
19362
|
if (mechanism === "systemd") {
|
|
19326
19363
|
const system = ctx.root || existsSync37(systemUnitPathFor(label));
|
|
19327
19364
|
const ctl = system ? ["systemctl"] : ["systemctl", "--user"];
|
|
19328
|
-
running =
|
|
19365
|
+
running = spawnSync10(ctl[0], [...ctl.slice(1), "is-active", "--quiet", `${label}.service`], { env: withUserBusEnv() }).status === 0;
|
|
19329
19366
|
if (!system) {
|
|
19330
|
-
const out =
|
|
19367
|
+
const out = spawnSync10("loginctl", ["show-user", ctx.user, "-p", "Linger"], { encoding: "utf8" });
|
|
19331
19368
|
lingering = /Linger=yes/.test(out.stdout ?? "");
|
|
19332
19369
|
}
|
|
19333
19370
|
} else if (mechanism === "cron") {
|
|
19334
19371
|
running = true;
|
|
19335
19372
|
} else if (mechanism === "launchd") {
|
|
19336
|
-
running =
|
|
19373
|
+
running = spawnSync10("launchctl", ["list", label]).status === 0;
|
|
19337
19374
|
}
|
|
19338
19375
|
return { mechanism, unitsStale, running, lingering };
|
|
19339
19376
|
},
|
|
@@ -19359,7 +19396,7 @@ function realProvisionDeps(crewHome) {
|
|
|
19359
19396
|
let wrote = false;
|
|
19360
19397
|
for (const [key, value2] of [["user.name", have.name ? null : name], ["user.email", have.email ? null : email]]) {
|
|
19361
19398
|
if (value2 === null) continue;
|
|
19362
|
-
const res =
|
|
19399
|
+
const res = spawnSync10("git", ["config", "--global", key, value2], { encoding: "utf8" });
|
|
19363
19400
|
if (res.status !== 0) throw new Error(`git config --global ${key}: ${(res.stderr ?? "").trim() || `exited ${res.status}`}`);
|
|
19364
19401
|
wrote = true;
|
|
19365
19402
|
}
|
|
@@ -24117,7 +24154,7 @@ async function runCommentDeliveryPass(deps) {
|
|
|
24117
24154
|
|
|
24118
24155
|
// src/launchd-start.ts
|
|
24119
24156
|
import { readFileSync as readFileSync48 } from "fs";
|
|
24120
|
-
import { spawnSync as
|
|
24157
|
+
import { spawnSync as spawnSync13 } from "child_process";
|
|
24121
24158
|
|
|
24122
24159
|
// src/daemon-liveness.ts
|
|
24123
24160
|
import { existsSync as existsSync49, readFileSync as readFileSync47 } from "fs";
|
|
@@ -26455,7 +26492,7 @@ async function settleSignOut(plan, tracker, state, ticketId, emit) {
|
|
|
26455
26492
|
}
|
|
26456
26493
|
|
|
26457
26494
|
// src/daemon-liveness.ts
|
|
26458
|
-
import { spawnSync as
|
|
26495
|
+
import { spawnSync as spawnSync12 } from "child_process";
|
|
26459
26496
|
function parseLaunchctlPrint(text2) {
|
|
26460
26497
|
const num2 = (re) => {
|
|
26461
26498
|
const m = re.exec(text2);
|
|
@@ -26503,7 +26540,7 @@ function classifyDaemon(o) {
|
|
|
26503
26540
|
}
|
|
26504
26541
|
function probeDaemonUnit(o) {
|
|
26505
26542
|
const run4 = o.run ?? ((cmd) => {
|
|
26506
|
-
const r =
|
|
26543
|
+
const r = spawnSync12(cmd[0], cmd.slice(1), { encoding: "utf8" });
|
|
26507
26544
|
return r.error ? null : { status: r.status, stdout: r.stdout ?? "" };
|
|
26508
26545
|
});
|
|
26509
26546
|
const installed = o.plan.unitPaths.some((p) => existsSync49(p));
|
|
@@ -26577,12 +26614,9 @@ function planLaunchdStart(r, unit) {
|
|
|
26577
26614
|
}
|
|
26578
26615
|
var LOG_TAIL_LINES = 10;
|
|
26579
26616
|
function defaultRun(cmd) {
|
|
26580
|
-
const r =
|
|
26617
|
+
const r = spawnSync13(cmd[0], cmd.slice(1), { encoding: "utf8" });
|
|
26581
26618
|
return r.error ? null : { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
26582
26619
|
}
|
|
26583
|
-
function defaultSleep2(ms3) {
|
|
26584
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms3);
|
|
26585
|
-
}
|
|
26586
26620
|
function defaultReadLog(path) {
|
|
26587
26621
|
try {
|
|
26588
26622
|
return readFileSync48(path, "utf8");
|
|
@@ -26596,7 +26630,7 @@ function logTail2(text2, n = LOG_TAIL_LINES) {
|
|
|
26596
26630
|
}
|
|
26597
26631
|
function startLaunchdDaemon(o) {
|
|
26598
26632
|
const run4 = o.run ?? defaultRun;
|
|
26599
|
-
const sleep = o.sleep ??
|
|
26633
|
+
const sleep = o.sleep ?? sleepSync;
|
|
26600
26634
|
const readLog = o.readLog ?? defaultReadLog;
|
|
26601
26635
|
let out = "";
|
|
26602
26636
|
let err3 = "";
|
|
@@ -28561,7 +28595,7 @@ function readRepoSetupPrompt(crewHome) {
|
|
|
28561
28595
|
}
|
|
28562
28596
|
|
|
28563
28597
|
// src/repos-check.ts
|
|
28564
|
-
import { spawnSync as
|
|
28598
|
+
import { spawnSync as spawnSync14 } from "child_process";
|
|
28565
28599
|
import { readFileSync as readFileSync53 } from "fs";
|
|
28566
28600
|
import { basename as basename12 } from "path";
|
|
28567
28601
|
var POSIX_SHELL = /^(?:ba|z|da|k|a|mk)?sh$|^fish$/;
|
|
@@ -28570,10 +28604,10 @@ function checkHookSyntax(script, shell) {
|
|
|
28570
28604
|
const name = basename12(spec.bin).replace(/\.exe$/i, "").toLowerCase();
|
|
28571
28605
|
let run4;
|
|
28572
28606
|
if (POSIX_SHELL.test(name)) {
|
|
28573
|
-
run4 =
|
|
28607
|
+
run4 = spawnSync14(spec.bin, ["-n"], { input: script, encoding: "utf8" });
|
|
28574
28608
|
} else if (/^(pwsh|powershell)$/.test(name)) {
|
|
28575
28609
|
const parse3 = "$e=$null;[void][System.Management.Automation.Language.Parser]::ParseInput($env:CREW_CHECK_SCRIPT,[ref]$null,[ref]$e);if($e){$e|ForEach-Object{[Console]::Error.WriteLine($_.Message)};exit 1}";
|
|
28576
|
-
run4 =
|
|
28610
|
+
run4 = spawnSync14(spec.bin, ["-NoProfile", "-NonInteractive", "-Command", parse3], {
|
|
28577
28611
|
encoding: "utf8",
|
|
28578
28612
|
env: { ...process.env, CREW_CHECK_SCRIPT: script }
|
|
28579
28613
|
});
|
|
@@ -29826,7 +29860,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
29826
29860
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
29827
29861
|
import { join as join61 } from "path";
|
|
29828
29862
|
function builtVersion() {
|
|
29829
|
-
return true ? "0.169.
|
|
29863
|
+
return true ? "0.169.3" : null;
|
|
29830
29864
|
}
|
|
29831
29865
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
29832
29866
|
function newestMtime(path) {
|
|
@@ -30185,13 +30219,10 @@ function removePersistedSyncDaemon(stateDir, workspaceId) {
|
|
|
30185
30219
|
} catch {
|
|
30186
30220
|
}
|
|
30187
30221
|
}
|
|
30188
|
-
function sleepSync2(ms3) {
|
|
30189
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms3);
|
|
30190
|
-
}
|
|
30191
30222
|
function waitForExit(pid, alive, timeoutMs = 5e3) {
|
|
30192
30223
|
const deadline = Date.now() + timeoutMs;
|
|
30193
30224
|
while (alive(pid) && Date.now() < deadline) {
|
|
30194
|
-
|
|
30225
|
+
sleepSync(50);
|
|
30195
30226
|
}
|
|
30196
30227
|
}
|
|
30197
30228
|
function readAllPersistedSyncWorkspaceIds(stateDir) {
|
|
@@ -32134,6 +32165,12 @@ if (argv[0] === "self-launch-check") {
|
|
|
32134
32165
|
`);
|
|
32135
32166
|
process.exit(verdict.ok ? 0 : 1);
|
|
32136
32167
|
}
|
|
32168
|
+
if (argv[0] === "sleep-sync-check") {
|
|
32169
|
+
const verdict = sleepSyncCheck();
|
|
32170
|
+
(verdict.ok ? process.stdout : process.stderr).write(`${verdict.message}
|
|
32171
|
+
`);
|
|
32172
|
+
process.exit(verdict.ok ? 0 : 1);
|
|
32173
|
+
}
|
|
32137
32174
|
var staleBundle = bundleStaleness({ built: builtVersion(), current: crewVersion(CREW_HOME), home: CREW_HOME, compiled: isCompiledBinary(import.meta.url) });
|
|
32138
32175
|
if (staleBundle) process.stderr.write(`crew: warning: ${staleBundle.message}
|
|
32139
32176
|
`);
|
|
@@ -33021,7 +33058,7 @@ if (command === "passenger-sync-daemon") {
|
|
|
33021
33058
|
`removing stale run timer from before the persistent-service cutover: ${staleTimer}${dryRun ? " (dry run, not applied)" : ""}`
|
|
33022
33059
|
);
|
|
33023
33060
|
if (!dryRun) {
|
|
33024
|
-
|
|
33061
|
+
spawnSync15("systemctl", ["--user", "disable", "--now", `${label}.timer`], { cwd: CREW_HOME, env: withUserBusEnv() });
|
|
33025
33062
|
try {
|
|
33026
33063
|
unlinkSync6(staleTimer);
|
|
33027
33064
|
} catch {
|
|
@@ -33106,7 +33143,7 @@ if (command === "passenger-sync-daemon") {
|
|
|
33106
33143
|
async function doctorFix(o) {
|
|
33107
33144
|
const routes = await Promise.all(routesInScope(cfg.routes, named).map((c) => gatherHealth({ route: c.route, enabled: c.enabled, hasRepos: reposOf(c).length > 0 }, () => routeProblems(c))));
|
|
33108
33145
|
const unitExists = (p) => existsSync60(p);
|
|
33109
|
-
const crontab = o.host === "linux" ?
|
|
33146
|
+
const crontab = o.host === "linux" ? spawnSync15("crontab", ["-l"], { encoding: "utf8" }).stdout ?? "" : "";
|
|
33110
33147
|
const schedulerAbsent = o.host !== "windows" ? !schedulerInstalled(planInstall(cfg.ship, CREW_HOME, o.host, detectSystemd(), "run", installContext()), unitExists, crontab) : true;
|
|
33111
33148
|
const plan = planFix({ routes, schedulerAbsent, host: o.host });
|
|
33112
33149
|
if (plan.actions.length === 0) {
|
|
@@ -33124,7 +33161,7 @@ if (command === "passenger-sync-daemon") {
|
|
|
33124
33161
|
if (a.kind === "refresh-snapshot") {
|
|
33125
33162
|
if (prompter && !await prompter.confirm(`${a.route}: the connect snapshot is out of date \u2014 run \`crew connect ${a.route}\` and reload the daemon?`, true)) continue;
|
|
33126
33163
|
const self = selfLaunch();
|
|
33127
|
-
const run4 = (args) =>
|
|
33164
|
+
const run4 = (args) => spawnSync15(self.command, [...self.args, ...args], { stdio: "inherit", cwd: process.cwd(), env: process.env });
|
|
33128
33165
|
const conn = run4(["connect", a.route]);
|
|
33129
33166
|
if (conn.status !== 0) {
|
|
33130
33167
|
process.stdout.write(`fix: crew connect ${a.route} exited ${conn.status ?? "abnormally"} \u2014 snapshot not refreshed
|
|
@@ -34663,7 +34700,7 @@ ${f2.tail.trimEnd()}
|
|
|
34663
34700
|
dryRun,
|
|
34664
34701
|
...o,
|
|
34665
34702
|
run: (c) => {
|
|
34666
|
-
const res2 =
|
|
34703
|
+
const res2 = spawnSync15(c[0], c.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
34667
34704
|
return res2.error ? null : { status: res2.status, stdout: res2.stdout ?? "", stderr: res2.stderr ?? "" };
|
|
34668
34705
|
}
|
|
34669
34706
|
});
|
|
@@ -34680,7 +34717,7 @@ ${f2.tail.trimEnd()}
|
|
|
34680
34717
|
if (dryRun) process.stdout.write(`would run: ${control.stopCommand.join(" ")}
|
|
34681
34718
|
`);
|
|
34682
34719
|
else {
|
|
34683
|
-
const res2 =
|
|
34720
|
+
const res2 = spawnSync15(control.stopCommand[0], control.stopCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
34684
34721
|
if (res2.stdout) process.stdout.write(res2.stdout);
|
|
34685
34722
|
if (res2.stderr) process.stderr.write(res2.stderr);
|
|
34686
34723
|
}
|
|
@@ -34696,7 +34733,7 @@ ${f2.tail.trimEnd()}
|
|
|
34696
34733
|
}
|
|
34697
34734
|
let failed = false;
|
|
34698
34735
|
for (const cmd2 of commands) {
|
|
34699
|
-
const res2 =
|
|
34736
|
+
const res2 = spawnSync15(cmd2[0], cmd2.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
34700
34737
|
if (res2.stdout) process.stdout.write(res2.stdout);
|
|
34701
34738
|
if (res2.stderr) process.stderr.write(res2.stderr);
|
|
34702
34739
|
if (cmd2 === control.startCommand && (res2.error || res2.status !== 0)) {
|
|
@@ -34713,7 +34750,7 @@ ${f2.tail.trimEnd()}
|
|
|
34713
34750
|
`);
|
|
34714
34751
|
break;
|
|
34715
34752
|
}
|
|
34716
|
-
const res =
|
|
34753
|
+
const res = spawnSync15(cmd[0], cmd.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
34717
34754
|
if (res.stdout) process.stdout.write(res.stdout);
|
|
34718
34755
|
if (res.stderr) process.stderr.write(res.stderr);
|
|
34719
34756
|
if (daemonSub !== "status" && (res.error || res.status !== 0)) {
|
|
@@ -37251,7 +37288,7 @@ ${where.join("\n")}`);
|
|
|
37251
37288
|
process.stdout.write(upOutput(res, terminal));
|
|
37252
37289
|
const opener = openerFor(process.platform);
|
|
37253
37290
|
if (opener && shouldOpen({ open: flag("open"), noOpen: flag("no-open"), json: jsonP, terminal })) {
|
|
37254
|
-
const r =
|
|
37291
|
+
const r = spawnSync15(opener, [res.url], { stdio: "ignore" });
|
|
37255
37292
|
if (r.error || r.status !== 0) emit.warn(withFix(`crew periscope: could not open ${res.url} with ${opener}`, `open ${res.url} yourself`));
|
|
37256
37293
|
}
|
|
37257
37294
|
}
|
|
@@ -37592,10 +37629,10 @@ ${where.join("\n")}`);
|
|
|
37592
37629
|
}
|
|
37593
37630
|
const host = hostPlatform();
|
|
37594
37631
|
const control = host === "windows" ? null : planDaemonControl(CREW_HOME, host, detectSystemd());
|
|
37595
|
-
const unitStatus = control?.statusCommand ?
|
|
37632
|
+
const unitStatus = control?.statusCommand ? spawnSync15(control.statusCommand[0], control.statusCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() }) : null;
|
|
37596
37633
|
const unitRunning = unitStatus !== null && !unitStatus.error && unitStatus.status === 0;
|
|
37597
37634
|
if (!unitRunning && control?.mechanism === "systemd" && control.startCommand) {
|
|
37598
|
-
const res =
|
|
37635
|
+
const res = spawnSync15(control.startCommand[0], control.startCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8" });
|
|
37599
37636
|
if (res.error || res.status !== 0) {
|
|
37600
37637
|
emit.error(withFix(`crew reload: ${control.startCommand.join(" ")} exited ${res.status ?? "error"}`, "`crew doctor`"));
|
|
37601
37638
|
process.exitCode = 1;
|
|
@@ -37616,7 +37653,7 @@ ${where.join("\n")}`);
|
|
|
37616
37653
|
);
|
|
37617
37654
|
if (flag("now") && control?.stopCommand && control.startCommand) {
|
|
37618
37655
|
for (const cmd of [control.stopCommand, control.startCommand]) {
|
|
37619
|
-
const res =
|
|
37656
|
+
const res = spawnSync15(cmd[0], cmd.slice(1), { cwd: CREW_HOME, encoding: "utf8", env: withUserBusEnv() });
|
|
37620
37657
|
if (cmd === control.startCommand && (res.error || res.status !== 0)) {
|
|
37621
37658
|
emit.error(withFix(`crew reload: ${cmd.join(" ")} exited ${res.status ?? "error"}`, "`crew doctor`"));
|
|
37622
37659
|
process.exitCode = 1;
|
|
@@ -37756,7 +37793,7 @@ ${where.join("\n")}`);
|
|
|
37756
37793
|
writeFileSync45(join67(dir, "README.md"), SAMPLE_README);
|
|
37757
37794
|
writeFileSync45(join67(dir, ".crew.yaml"), SAMPLE_CREW_YAML);
|
|
37758
37795
|
const g = (...a) => {
|
|
37759
|
-
const r =
|
|
37796
|
+
const r = spawnSync15("git", a, { cwd: dir, encoding: "utf8" });
|
|
37760
37797
|
if (r.status !== 0) fail2(`git ${a[0]} failed in ${dir}: ${(r.stderr || r.stdout).trim()}`);
|
|
37761
37798
|
};
|
|
37762
37799
|
g("init", "-b", "main");
|
|
@@ -38445,7 +38482,7 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
|
|
|
38445
38482
|
const ctl = planDaemonControl(CREW_HOME, host, true);
|
|
38446
38483
|
const unitPlan = planInstall(cfg.ship, CREW_HOME, host, true, "run", installContext());
|
|
38447
38484
|
if (ctl.statusCommand && unitPlan.unitPaths.some((p) => existsSync60(p))) {
|
|
38448
|
-
const st =
|
|
38485
|
+
const st = spawnSync15(ctl.statusCommand[0], ctl.statusCommand.slice(1), { cwd: CREW_HOME, encoding: "utf8" });
|
|
38449
38486
|
if (!st.error && st.status !== 0) {
|
|
38450
38487
|
R.line("daemon unit: WARN installed but not running \u2014 no work is picked up; run `crew reload` (or `crew daemon start`), and `crew install` if the unit still says Restart=on-failure\n");
|
|
38451
38488
|
}
|
package/package.json
CHANGED