@feigi/fleet-ctl 3.23.40 → 3.23.41
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/recipe-prove.mjs +10 -6
package/package.json
CHANGED
package/scripts/recipe-prove.mjs
CHANGED
|
@@ -58,10 +58,11 @@
|
|
|
58
58
|
// a git or filesystem fault stopped it before the cache was settled
|
|
59
59
|
// (a git command could not be started, the reader's own git
|
|
60
60
|
// included, or that git started and could not run; the reader's `sh`,
|
|
61
|
-
// `node`, `mktemp` or `cat` could not be started,
|
|
62
|
-
// mid-read — a `cat` that ran and
|
|
63
|
-
// exit 1; the cache or its temp
|
|
64
|
-
// directory under $TMPDIR is
|
|
61
|
+
// `node`, `mktemp` or `cat` could not be started, its `sh` was killed
|
|
62
|
+
// by a signal, or its `node` died mid-read — a `cat` that ran and
|
|
63
|
+
// failed stays the reader's refusal, exit 1; the cache or its temp
|
|
64
|
+
// file could not be written). The log directory under $TMPDIR is
|
|
65
|
+
// removed.
|
|
65
66
|
|
|
66
67
|
import { spawnSync } from "node:child_process";
|
|
67
68
|
import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
@@ -291,7 +292,8 @@ function prove(o, wt, logs) {
|
|
|
291
292
|
// Write, then read back through the one reader. A cache it refuses is undone:
|
|
292
293
|
// the prior bytes restored, or the file removed when none stood before. The
|
|
293
294
|
// cache is undone just the same when the read-back is no verdict: an `sh` that
|
|
294
|
-
// could not be started read nothing; a
|
|
295
|
+
// could not be started read nothing; an `sh` killed by a signal has no exit
|
|
296
|
+
// status and reached no verdict; a reader that exits READER_COULD_NOT_RUN
|
|
295
297
|
// could not start its `node`, `mktemp` or `cat`, or lost its `node` mid-read;
|
|
296
298
|
// and the reader runs git itself and reads a git that will not run as no
|
|
297
299
|
// repository at all, so its refusal is a verdict on what was proven only while
|
|
@@ -317,6 +319,7 @@ function writeCache(cache, recipe, repo) {
|
|
|
317
319
|
else writeFileSync(cache, prior);
|
|
318
320
|
if (r.error && !r.pid) throw cannot(`could not start sh to read the Recipe cache back: ${r.error.message}`);
|
|
319
321
|
if (r.status === READER_COULD_NOT_RUN) throw cannot(`${r.stderr.trim()} — the Recipe cache reader could not run a tool it needs, so its refusal is no verdict on what was proven`);
|
|
322
|
+
if (r.signal) throw cannot(`the Recipe cache reader's sh was killed by ${r.signal}${errorCause(r.error)}, so it reached no verdict on what was proven`);
|
|
320
323
|
const noVerdict = (why) => cannot(`${why} — the Recipe cache reader runs git, so its refusal is no verdict on what was proven`);
|
|
321
324
|
let probe;
|
|
322
325
|
try {
|
|
@@ -326,7 +329,8 @@ function writeCache(cache, recipe, repo) {
|
|
|
326
329
|
throw noVerdict(e.message);
|
|
327
330
|
}
|
|
328
331
|
if (!probe.ok) throw noVerdict(`git started but does not run: \`git --version\` did not exit 0${probe.err ? `: ${probe.err}` : " and wrote nothing to stderr"}`);
|
|
329
|
-
|
|
332
|
+
const said = r.stderr.trim() || r.stdout.trim();
|
|
333
|
+
throw notProven(`the Recipe cache reader refuses what was proven: ${said || `it wrote nothing and exited with status ${r.status}`}`);
|
|
330
334
|
}
|
|
331
335
|
}
|
|
332
336
|
|