@feigi/fleet-ctl 3.158.6 → 3.158.7
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/package.json +1 -1
- package/scripts/phase0.mjs +17 -3
package/package.json
CHANGED
package/scripts/phase0.mjs
CHANGED
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
|
|
195
195
|
import { spawn, spawnSync } from "node:child_process";
|
|
196
196
|
import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
197
|
-
import { dirname, join, resolve } from "node:path";
|
|
197
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
198
198
|
import { fileURLToPath } from "node:url";
|
|
199
199
|
import { makeDie, defineFlags, isDigits } from "./arg.mjs";
|
|
200
200
|
import { alarmFile } from "./controller-alarm.mjs";
|
|
@@ -599,10 +599,24 @@ function shortlist({ cwd }) {
|
|
|
599
599
|
return ok("shortlist built");
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
+
// The same `.fleet/` by the directory it names: the checkout holding it is
|
|
603
|
+
// resolved through symlinks and the `.fleet` name kept, so it works before
|
|
604
|
+
// `.fleet/` exists. A path that is not absolute, or whose checkout does not
|
|
605
|
+
// resolve, stays as given.
|
|
606
|
+
function fleetIdentity(path) {
|
|
607
|
+
if (typeof path !== "string" || !isAbsolute(path)) return path;
|
|
608
|
+
try {
|
|
609
|
+
return join(realpathSync(dirname(path)), basename(path));
|
|
610
|
+
} catch {
|
|
611
|
+
return path;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
602
615
|
// The controller alarm: this omp's own record that its timer is armed against
|
|
603
616
|
// this checkout's `.fleet/` (controller-alarm.mjs writes it at session_start).
|
|
604
617
|
// The record is read, not trusted: it must name this omp's pid and start time
|
|
605
|
-
// and this `.fleet
|
|
618
|
+
// and this `.fleet/` — the same directory, whichever way omp and this process
|
|
619
|
+
// each spell the path to it. Messages print both as spelled.
|
|
606
620
|
function alarm({ fleetDir }) {
|
|
607
621
|
const tail = " — restart omp";
|
|
608
622
|
let controller;
|
|
@@ -633,7 +647,7 @@ function alarm({ fleetDir }) {
|
|
|
633
647
|
if (missing.length > 0) return failed(`controller alarm file ${path} lacks ${missing.join(", ")}${tail}`);
|
|
634
648
|
if (rec.pid !== controller.pid) return failed(`controller alarm file ${path} names pid ${rec.pid}, but this omp is pid ${controller.pid}${tail}`);
|
|
635
649
|
if (rec.lstart !== controller.lstart) return failed(`controller alarm file ${path} was written by a process started at "${rec.lstart}", but this omp started at "${controller.lstart}"${tail}`);
|
|
636
|
-
if (rec.fleet !== fleetDir) return failed(`controller alarm file ${path} names fleet "${rec.fleet}", not ${fleetDir}${tail}`);
|
|
650
|
+
if (fleetIdentity(rec.fleet) !== fleetIdentity(fleetDir)) return failed(`controller alarm file ${path} names fleet "${rec.fleet}", not ${fleetDir}${tail}`);
|
|
637
651
|
return ok(`controller alarm armed: pid ${controller.pid}, ${fleetDir}`);
|
|
638
652
|
}
|
|
639
653
|
|