pi-straw-boss 0.75.0 → 0.75.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/dist/server/{chunk-4OLRDO5C.mjs → chunk-PQZBUOCK.mjs} +77 -24
- package/dist/server/cli.mjs +2 -2
- package/dist/server/main.mjs +219 -176
- package/package.json +1 -1
- package/src/balance.d.mts +1 -1
- package/src/balance.mjs +5 -3
- package/src/exe.d.mts +2 -1
- package/src/exe.mjs +72 -9
- package/src/herdr.ts +7 -4
- package/src/hygiene.ts +3 -3
- package/src/lan/ca.ts +2 -2
- package/src/lan/firewall.ts +2 -2
- package/src/lanface.ts +2 -2
- package/src/link/allow.ts +1 -1
- package/src/pairing.ts +1 -1
- package/src/procs/killguard.ts +1 -1
- package/src/procs/table.ts +1 -1
- package/src/remote.ts +1 -1
- package/src/server/carbook.ts +17 -3
- package/src/server/carops.ts +4 -2
- package/src/server/guihost.ts +5 -2
- package/src/server/lineage.ts +1 -1
- package/src/server/main.ts +1 -1
- package/src/server/runtools.ts +10 -3
- package/src/server/towers.ts +2 -2
- package/src/server/traincmds.ts +1 -1
- package/src/server/trainyard.ts +2 -2
- package/src/spawn.ts +13 -6
- package/src/startof.ts +1 -1
- package/src/train/accept.ts +12 -2
- package/src/train/board.ts +2 -2
- package/src/train/cars.ts +6 -5
- package/src/train/spec.ts +2 -0
- package/src/trainguard.ts +2 -2
- package/src/trust/ask.ts +8 -1
- package/src/trust/intent.ts +42 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/exe.mjs
|
|
2
|
-
import { execFile, execFileSync } from "node:child_process";
|
|
2
|
+
import { execFile, execFileSync, spawn } from "node:child_process";
|
|
3
3
|
import { accessSync, constants, statSync } from "node:fs";
|
|
4
4
|
import { posix, win32 } from "node:path";
|
|
5
5
|
var ExeNotFound = class extends Error {
|
|
@@ -47,8 +47,48 @@ function resolveExe(name, deps = {}) {
|
|
|
47
47
|
return found;
|
|
48
48
|
}
|
|
49
49
|
var forgetExe = (name) => void (name === void 0 ? cache.clear() : cache.delete(name));
|
|
50
|
+
var GRACE_MS = 2e3;
|
|
51
|
+
var signalGroup = (pid, signal) => {
|
|
52
|
+
try {
|
|
53
|
+
return process.kill(-pid, signal);
|
|
54
|
+
} catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
function execFileByDeadline(file, args, options, done) {
|
|
59
|
+
const alone = process.platform === "win32" || options.group === false, limit = options.maxBuffer ?? 1024 * 1024, cmd = [file, ...args].join(" ");
|
|
60
|
+
const child = spawn(file, args, { cwd: options.cwd, env: options.env, windowsHide: options.windowsHide, detached: !alone });
|
|
61
|
+
let stdout = "", stderr = "", settled = false;
|
|
62
|
+
let ended;
|
|
63
|
+
const settle = (error) => {
|
|
64
|
+
if (settled) return;
|
|
65
|
+
settled = true;
|
|
66
|
+
clearTimeout(timer);
|
|
67
|
+
for (const stream of [child.stdin, child.stdout, child.stderr]) stream?.destroy();
|
|
68
|
+
done(error, stdout, stderr);
|
|
69
|
+
};
|
|
70
|
+
const failure = (what, marks) => Object.assign(new Error(`${what}: ${cmd}${stderr ? `
|
|
71
|
+
${stderr}` : ""}`), { cmd, ...marks });
|
|
72
|
+
const byStatus = ({ code, signal }) => settle(code === 0 ? null : failure("Command failed", { code, killed: false, signal }));
|
|
73
|
+
const cutOff = (what, code) => {
|
|
74
|
+
if (settled) return;
|
|
75
|
+
settle(failure(what, { code, killed: true, signal: "SIGTERM" }));
|
|
76
|
+
if (ended) return;
|
|
77
|
+
const send = (signal) => alone || child.pid === void 0 ? child.kill(signal) : signalGroup(child.pid, signal);
|
|
78
|
+
send("SIGTERM");
|
|
79
|
+
const hard = setTimeout(() => (send("SIGKILL"), child.unref()), options.grace ?? GRACE_MS);
|
|
80
|
+
child.once("exit", () => (alone || child.pid === void 0 || !signalGroup(child.pid, 0)) && clearTimeout(hard));
|
|
81
|
+
};
|
|
82
|
+
const timer = setTimeout(() => ended ? byStatus(ended) : cutOff(`Command timed out after ${options.deadline} ms`, null), options.deadline);
|
|
83
|
+
child.stdout?.setEncoding("utf8").on("data", (chunk) => (stdout += chunk).length > limit && cutOff("stdout maxBuffer length exceeded", "ERR_CHILD_PROCESS_STDIO_MAXBUFFER"));
|
|
84
|
+
child.stderr?.setEncoding("utf8").on("data", (chunk) => (stderr += chunk).length > limit && cutOff("stderr maxBuffer length exceeded", "ERR_CHILD_PROCESS_STDIO_MAXBUFFER"));
|
|
85
|
+
child.on("error", settle);
|
|
86
|
+
child.once("exit", (code, signal) => ended = { code, signal });
|
|
87
|
+
child.once("close", (code, signal) => byStatus({ code, signal }));
|
|
88
|
+
return child;
|
|
89
|
+
}
|
|
50
90
|
function execFileExe(name, args, options, done) {
|
|
51
|
-
const env = options.env ?? process.env;
|
|
91
|
+
const env = options.env ?? process.env, { deadline } = options;
|
|
52
92
|
const start = (again) => {
|
|
53
93
|
let file;
|
|
54
94
|
try {
|
|
@@ -63,9 +103,8 @@ function execFileExe(name, args, options, done) {
|
|
|
63
103
|
);
|
|
64
104
|
return void 0;
|
|
65
105
|
}
|
|
66
|
-
|
|
67
|
-
if (error &&
|
|
68
|
-
error.code === "ENOENT" && again) {
|
|
106
|
+
const finish = (error, stdout, stderr) => {
|
|
107
|
+
if (error && error.code === "ENOENT" && again) {
|
|
69
108
|
forgetExe(name);
|
|
70
109
|
let next;
|
|
71
110
|
try {
|
|
@@ -81,7 +120,8 @@ function execFileExe(name, args, options, done) {
|
|
|
81
120
|
if (next !== file) return void start(false);
|
|
82
121
|
}
|
|
83
122
|
done(error, String(stdout), String(stderr));
|
|
84
|
-
}
|
|
123
|
+
};
|
|
124
|
+
return deadline === void 0 ? execFile(file, args, options, finish) : execFileByDeadline(file, args, { ...options, deadline }, finish);
|
|
85
125
|
};
|
|
86
126
|
return start(true);
|
|
87
127
|
}
|
|
@@ -132,7 +172,7 @@ var TTL_MS = 10 * 6e4;
|
|
|
132
172
|
var START_MS = 3e4;
|
|
133
173
|
var START_ATTEMPTS = 20;
|
|
134
174
|
var herdrRun = (args, timeoutMs = 5e3) => new Promise((resolve4, reject) => {
|
|
135
|
-
execFileExe(process.env.HERDR_BIN_PATH || "herdr", args, {
|
|
175
|
+
execFileExe(process.env.HERDR_BIN_PATH || "herdr", args, { deadline: timeoutMs }, (error, stdout, stderr) => {
|
|
136
176
|
if (error) reject(Object.assign(new Error(`herdr ${args.join(" ")} failed: ${stderr.trim() || error.message}`), { stderr: stderr.trim(), code: error.code, killed: error.killed === true, signal: error.signal ?? void 0 }));
|
|
137
177
|
else resolve4(stdout);
|
|
138
178
|
});
|
|
@@ -179,14 +219,16 @@ async function panes(run4, workspace) {
|
|
|
179
219
|
return (await result(run4, ["pane", "list", ...workspace ? ["--workspace", workspace] : []])).panes;
|
|
180
220
|
}
|
|
181
221
|
var herdrCall = (socketPath = herdrSocket()) => (method, params, timeoutMs = 5e3) => new Promise((resolve4, reject) => {
|
|
182
|
-
const socket = createConnection(localEndpoint(socketPath))
|
|
222
|
+
const socket = createConnection(localEndpoint(socketPath)), text4 = new StringDecoder("utf8");
|
|
183
223
|
let reply = "";
|
|
184
|
-
const fail = (code, message) => (socket.destroy(), reject(new HerdrError(code, `herdr ${method} failed: ${code} ${message}`.trim())));
|
|
224
|
+
const fail = (code, message) => (clearTimeout(timer), socket.destroy(), reject(new HerdrError(code, `herdr ${method} failed: ${code} ${message}`.trim())));
|
|
225
|
+
const timer = setTimeout(() => fail("timeout", `no answer within ${timeoutMs} ms`), timeoutMs);
|
|
185
226
|
socket.on("connect", () => socket.write(`${JSON.stringify({ id: `straw-boss-${Date.now()}`, method, params })}
|
|
186
227
|
`));
|
|
187
228
|
socket.on("data", (chunk) => {
|
|
188
229
|
reply += text4.write(chunk);
|
|
189
230
|
if (!reply.includes("\n")) return;
|
|
231
|
+
clearTimeout(timer);
|
|
190
232
|
socket.destroy();
|
|
191
233
|
try {
|
|
192
234
|
const { result: result2, error } = JSON.parse(reply.split("\n")[0]);
|
|
@@ -196,7 +238,6 @@ var herdrCall = (socketPath = herdrSocket()) => (method, params, timeoutMs = 5e3
|
|
|
196
238
|
fail("bad_frame", reply.slice(0, 200));
|
|
197
239
|
}
|
|
198
240
|
});
|
|
199
|
-
socket.on("timeout", () => fail("timeout", `no answer within ${timeoutMs} ms`));
|
|
200
241
|
socket.on("error", (error) => fail("socket_error", error.message));
|
|
201
242
|
socket.on("close", () => fail("closed", "the connection closed before an answer"));
|
|
202
243
|
});
|
|
@@ -623,7 +664,7 @@ var spawnQuietly = (file, args, { timeout, ...options }, done) => {
|
|
|
623
664
|
return child;
|
|
624
665
|
};
|
|
625
666
|
var laterBy = (ms) => new Promise((done) => setTimeout(done, ms).unref());
|
|
626
|
-
function createStartOf({ platform = process.platform, ps = (pid) => String(execFileSyncExe("ps", ["-o", "lstart=", "-p", String(pid)], { encoding: "utf8", timeout: 2e3, stdio: ["ignore", "pipe", "ignore"], env: { ...process.env, LC_ALL: "C", TZ: "UTC" } })), launch: launch2 = spawnQuietly, now = Date.now, wait = laterBy } = {}) {
|
|
667
|
+
function createStartOf({ platform = process.platform, ps = (pid) => String(execFileSyncExe("ps", ["-o", "lstart=", "-p", String(pid)], { encoding: "utf8", timeout: 2e3, killSignal: "SIGKILL", stdio: ["ignore", "pipe", "ignore"], env: { ...process.env, LC_ALL: "C", TZ: "UTC" } })), launch: launch2 = spawnQuietly, now = Date.now, wait = laterBy } = {}) {
|
|
627
668
|
const known = /* @__PURE__ */ new Map(), asking = /* @__PURE__ */ new Map();
|
|
628
669
|
const valid = (pid) => Number.isSafeInteger(pid) && pid > 0;
|
|
629
670
|
const failedFor = (pid, fails) => pid === process.pid ? MAX_FAIL_MS : Math.min(FIRST_FAIL_MS * 2 ** (fails - 1), MAX_FAIL_MS);
|
|
@@ -1343,7 +1384,7 @@ var OPEN_LINE = "o open one in this computer's browser";
|
|
|
1343
1384
|
var CODE_MS2 = 10 * 6e4;
|
|
1344
1385
|
var MAX_CODES2 = 16;
|
|
1345
1386
|
var FORWARDED = ["x-forwarded-for", "x-forwarded-host", "x-forwarded-proto", "forwarded", "via", "tailscale-headers-info", "tailscale-user-login", "tailscale-user-name", "tailscale-funnel-request"];
|
|
1346
|
-
var tailscale = (args) => new Promise((done, fail) => execFileExe("tailscale", args, {
|
|
1387
|
+
var tailscale = (args) => new Promise((done, fail) => execFileExe("tailscale", args, { deadline: 15e3 }, (error, out, err) => error ? fail(new Error(error.code === "ENOENT" ? "Tailscale is not installed (no tailscale command on PATH)" : `tailscale ${args.join(" ")} failed: ${err.trim() || error.message}`)) : done(out)));
|
|
1347
1388
|
function parse(text4, what) {
|
|
1348
1389
|
try {
|
|
1349
1390
|
return JSON.parse(text4.trim() || "{}") ?? {};
|
|
@@ -2692,7 +2733,7 @@ async function helloOf(endpoint, secret, ms = 2e3) {
|
|
|
2692
2733
|
}
|
|
2693
2734
|
|
|
2694
2735
|
// src/server/client.ts
|
|
2695
|
-
import { spawn } from "node:child_process";
|
|
2736
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
2696
2737
|
import { randomBytes as randomBytes8 } from "node:crypto";
|
|
2697
2738
|
import { existsSync as existsSync5 } from "node:fs";
|
|
2698
2739
|
import { createConnection as createConnection3 } from "node:net";
|
|
@@ -2988,7 +3029,7 @@ var ServerError = class extends Error {
|
|
|
2988
3029
|
var SPAWN_OPTIONS = { detached: true, stdio: "ignore", windowsHide: true };
|
|
2989
3030
|
var spawnDetached = (spec) => {
|
|
2990
3031
|
guardSpawn(spec);
|
|
2991
|
-
const child =
|
|
3032
|
+
const child = spawn2(spec.command, spec.args, { ...spec.options, env: spec.env, cwd: spec.cwd });
|
|
2992
3033
|
child.unref();
|
|
2993
3034
|
noteStarted(child.pid);
|
|
2994
3035
|
child.once("exit", () => forgetStarted(child.pid));
|
|
@@ -3816,6 +3857,8 @@ function joinLocal(entries, mains, now, o = {}) {
|
|
|
3816
3857
|
var KINDS = ["assemble", "review", "full-check", "merge", "ci", "deploy", "deploy-verify", "rollback", "land"];
|
|
3817
3858
|
var CHECK_TYPES = ["run", "git", "report", "notice"];
|
|
3818
3859
|
var MAX_SB_BYTES = 8 * 1024;
|
|
3860
|
+
var MAX_CAR_TICKETS = 64;
|
|
3861
|
+
var MAX_TICKET_CHARS = 64;
|
|
3819
3862
|
var SHA_RE = /^[0-9a-f]{40}$/;
|
|
3820
3863
|
var NAME_RE = /^[A-Za-z0-9._-]{1,64}$/;
|
|
3821
3864
|
var CODE_RE = /^(\d{4})-(\d{2})-(\d{2})-([a-z]{1,2})$/;
|
|
@@ -4196,10 +4239,18 @@ function asksTrain(value) {
|
|
|
4196
4239
|
var NOT_SCANNED = /* @__PURE__ */ new Set(["head", "tested-on", "coordinator", "departs", "accept", "uat"]);
|
|
4197
4240
|
var base = (path) => path.split(/[\\/]/).pop() ?? path;
|
|
4198
4241
|
var namesCheckpoints = (path) => base(path).toLowerCase().split(/[^a-z0-9]+/).some((token) => /^(checkpoints?|conditions?)$/.test(token));
|
|
4242
|
+
function ticketBound(tickets) {
|
|
4243
|
+
const out = [];
|
|
4244
|
+
if (tickets.length > MAX_CAR_TICKETS) out.push(`sb: slip tickets names ${tickets.length} tickets, and a car carries at most ${MAX_CAR_TICKETS}: split the car into two or more slips`);
|
|
4245
|
+
const long2 = tickets.find((t) => t.length > MAX_TICKET_CHARS);
|
|
4246
|
+
if (long2 !== void 0) out.push(`sb: slip ticket ${shown(long2)} is longer than ${MAX_TICKET_CHARS} characters: name the ticket by its id`);
|
|
4247
|
+
return out;
|
|
4248
|
+
}
|
|
4199
4249
|
function checkSlip(slip, { appAccept }) {
|
|
4200
4250
|
const { fields, tickets, entries, problems } = parseSlip(slip), out = [...problems], car = tickets[0] ?? fields.branch ?? "unknown";
|
|
4201
4251
|
if (!SHA_RE.test(fields.head ?? "")) out.push("sb: slip head must be 40 hex");
|
|
4202
4252
|
if (tickets.length === 0) out.push("sb: slip tickets is empty");
|
|
4253
|
+
out.push(...ticketBound(tickets));
|
|
4203
4254
|
if (present2(fields.uat)) {
|
|
4204
4255
|
if (fields.uat.toLowerCase() === "none") out.push("sb: the slip's uat: line is gone; send accept: <evidence file> | none");
|
|
4205
4256
|
else out.push(acceptanceWord({ car, what: `UAT (${fields.uat})`, where: "slip line uat:" }));
|
|
@@ -4273,7 +4324,7 @@ function checkEvidence(raw, o) {
|
|
|
4273
4324
|
else {
|
|
4274
4325
|
for (const key2 of Object.keys(car)) if (present2(car[key2]) && !["app", "tickets", "branch", "head"].includes(key2)) out.push(`sb: evidence.car.${key2} is not a field`);
|
|
4275
4326
|
if (!isName(car.app)) out.push("sb: evidence.car.app must be a path-safe name");
|
|
4276
|
-
if (!(Array.isArray(car.tickets) && car.tickets.length > 0 && car.tickets.every((t) => text(t,
|
|
4327
|
+
if (!(Array.isArray(car.tickets) && car.tickets.length > 0 && car.tickets.length <= MAX_CAR_TICKETS && car.tickets.every((t) => text(t, MAX_TICKET_CHARS)))) out.push(`sb: evidence.car.tickets must be a list of 1 to ${MAX_CAR_TICKETS} tickets`);
|
|
4277
4328
|
if (!text(car.branch, 255)) out.push("sb: evidence.car.branch must be a non-empty string");
|
|
4278
4329
|
if (!SHA_RE.test(String(car.head))) out.push("sb: evidence.car.head must be 40 hex");
|
|
4279
4330
|
else if (o.head !== void 0 && car.head !== o.head) out.push("sb: evidence.car.head is not the slip's head");
|
|
@@ -4492,7 +4543,7 @@ var text2 = (value, max) => typeof value === "string" && value.trim() !== "" &&
|
|
|
4492
4543
|
var whole = (value, min, max = Number.MAX_SAFE_INTEGER) => typeof value === "number" && Number.isInteger(value) && value >= min && value <= max;
|
|
4493
4544
|
var unknown = (value, allowed, path) => Object.keys(value).filter((k) => present3(value[k]) && !allowed.includes(k)).map((k) => `sb: ${path}.${k} is not a field`);
|
|
4494
4545
|
var CAR_FIELDS = ["tickets", "branch", "head", "coordinator", "departs", "accept", "arrived", "accepted", "unverified"];
|
|
4495
|
-
var CAP = { session: 128, pane: 64, ticket:
|
|
4546
|
+
var CAP = { session: 128, pane: 64, ticket: MAX_TICKET_CHARS, tickets: MAX_CAR_TICKETS, branch: 255, coordinator: 128, departs: 300, accept: 1024, name: 64, kind: 32, reason: 600, by: 128, label: 64 };
|
|
4496
4547
|
function writerRefusals(w, path) {
|
|
4497
4548
|
if (!isObject2(w)) return [`sb: ${path} must be an object`];
|
|
4498
4549
|
const out = unknown(w, ["session", "pane", "pid", "started"], path);
|
|
@@ -4833,7 +4884,7 @@ function validateCarFile(value) {
|
|
|
4833
4884
|
const car = isObject2(value.car) ? value.car : void 0;
|
|
4834
4885
|
if (!car) out.push("sb: car.car must be an object");
|
|
4835
4886
|
else {
|
|
4836
|
-
if (!(Array.isArray(car.tickets) && car.tickets.length > 0 && car.tickets.every((t) => text3(t,
|
|
4887
|
+
if (!(Array.isArray(car.tickets) && car.tickets.length > 0 && car.tickets.length <= MAX_CAR_TICKETS && car.tickets.every((t) => text3(t, MAX_TICKET_CHARS)))) out.push(`sb: car.car.tickets must be a list of 1 to ${MAX_CAR_TICKETS} tickets`);
|
|
4837
4888
|
if (!text3(car.branch, 255)) out.push("sb: car.car.branch must be a non-empty string");
|
|
4838
4889
|
if (!SHA_RE.test(String(car.head))) out.push("sb: car.car.head must be 40 hex");
|
|
4839
4890
|
}
|
|
@@ -4936,7 +4987,8 @@ function slipsInText(body) {
|
|
|
4936
4987
|
return slipBlocks(lines).blocks.flatMap((block) => {
|
|
4937
4988
|
const parsed = parseSlip(block), f = parsed.fields;
|
|
4938
4989
|
if (!f.car || !isName(f.car) || !parsed.tickets.length || !f.branch || !SHA_RE.test(f.head ?? "")) return [];
|
|
4939
|
-
|
|
4990
|
+
const over = ticketBound(parsed.tickets).join("; "), tickets = over ? parsed.tickets.slice(0, MAX_CAR_TICKETS).map((t) => t.slice(0, MAX_TICKET_CHARS)) : parsed.tickets;
|
|
4991
|
+
return [{ app: f.car, tickets, ...over ? { over } : {}, branch: f.branch, head: f.head, ...f.coordinator ? { coordinator: f.coordinator } : {} }];
|
|
4940
4992
|
});
|
|
4941
4993
|
}
|
|
4942
4994
|
var coordinatorWord = (ticket, coordinator, sender) => `sb: car ${ticket} names coordinator ${coordinator}, but ${sender} sent it; the slip is refused`;
|
|
@@ -5782,7 +5834,7 @@ function enterMarker(dir, name, started, now, deps) {
|
|
|
5782
5834
|
}
|
|
5783
5835
|
|
|
5784
5836
|
// src/server/traingate.ts
|
|
5785
|
-
import { spawn as
|
|
5837
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
5786
5838
|
import { createHash as createHash7, randomBytes as randomBytes11, randomUUID as randomUUID2 } from "node:crypto";
|
|
5787
5839
|
import { chmodSync as chmodSync7, closeSync as closeSync4, constants as constants4, fstatSync as fstatSync4, lstatSync as lstatSync6, mkdirSync as mkdirSync10, openSync as openSync4, readFileSync as readFileSync16, readSync as readSync3, renameSync as renameSync11, unlinkSync as unlinkSync4, writeFileSync as writeFileSync13 } from "node:fs";
|
|
5788
5840
|
import { availableParallelism, homedir as homedir3, loadavg } from "node:os";
|
|
@@ -5823,7 +5875,7 @@ function parsePs(text4) {
|
|
|
5823
5875
|
return table;
|
|
5824
5876
|
}
|
|
5825
5877
|
var run3 = (file, args) => new Promise((resolve4, reject) => {
|
|
5826
|
-
execFileExe(file, args, { encoding: "utf8", maxBuffer: 1 << 26,
|
|
5878
|
+
execFileExe(file, args, { encoding: "utf8", maxBuffer: 1 << 26, deadline: 15e3, env: { ...process.env, LC_ALL: "C", TZ: "UTC" } }, (error, stdout) => error && !stdout ? reject(error) : resolve4(stdout));
|
|
5827
5879
|
});
|
|
5828
5880
|
function exeName(link) {
|
|
5829
5881
|
const name = basename4(link.endsWith(" (deleted)") ? link.slice(0, -" (deleted)".length) : link);
|
|
@@ -5914,7 +5966,7 @@ var KILLS_DIR = "kills";
|
|
|
5914
5966
|
var cwdOfSync = (pid) => {
|
|
5915
5967
|
try {
|
|
5916
5968
|
if (process.platform === "linux") return readlinkSync3(`/proc/${pid}/cwd`).replace(/ \(deleted\)$/, "");
|
|
5917
|
-
return parseLsofCwd(String(execFileSyncExe("lsof", ["-a", "-d", "cwd", "-Fpfn", "-p", String(pid)], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5e3 }))).get(pid)?.path;
|
|
5969
|
+
return parseLsofCwd(String(execFileSyncExe("lsof", ["-a", "-d", "cwd", "-Fpfn", "-p", String(pid)], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5e3, killSignal: "SIGKILL" }))).get(pid)?.path;
|
|
5918
5970
|
} catch {
|
|
5919
5971
|
return void 0;
|
|
5920
5972
|
}
|
|
@@ -6022,7 +6074,7 @@ var reap = (refs, over = {}) => killSequence(refs, { read: () => readTable(void
|
|
|
6022
6074
|
|
|
6023
6075
|
// src/server/traingate.ts
|
|
6024
6076
|
var BEAT_MS = 3e4;
|
|
6025
|
-
var
|
|
6077
|
+
var GRACE_MS2 = 4e3;
|
|
6026
6078
|
var KILL_WAIT_MS = 500;
|
|
6027
6079
|
var TRY_GRACE_MS = 1e4;
|
|
6028
6080
|
var GATE_MAX_BOARDS = 4096;
|
|
@@ -6169,7 +6221,7 @@ var killGroup = (pid, signal) => signal === 0 ? process.kill(pid, 0) : sendSigna
|
|
|
6169
6221
|
var realSleep = (ms) => new Promise((done) => setTimeout(done, ms));
|
|
6170
6222
|
var lastLine = (text4) => text4.split(/\r?\n/).map((l) => l.trim()).filter(Boolean).at(-1) ?? "";
|
|
6171
6223
|
async function runGate(specFile, deps) {
|
|
6172
|
-
const d = { ...deps, beatMs: deps.beatMs ?? BEAT_MS, graceMs: deps.graceMs ??
|
|
6224
|
+
const d = { ...deps, beatMs: deps.beatMs ?? BEAT_MS, graceMs: deps.graceMs ?? GRACE_MS2, kill: deps.kill ?? killGroup };
|
|
6173
6225
|
const groupAlive = (pid) => {
|
|
6174
6226
|
try {
|
|
6175
6227
|
d.kill(-pid, 0);
|
|
@@ -6288,7 +6340,7 @@ async function runGate(specFile, deps) {
|
|
|
6288
6340
|
}
|
|
6289
6341
|
async function runChild(command, stdout, stderr, beat, deadline) {
|
|
6290
6342
|
const file = "/bin/sh";
|
|
6291
|
-
const child =
|
|
6343
|
+
const child = spawn3(file, ["-c", command], { cwd, detached: true, stdio: ["ignore", stdout, stderr], env: d.env });
|
|
6292
6344
|
const exited = new Promise((done) => {
|
|
6293
6345
|
child.once("exit", (code2, signal) => done({ code: code2, signal }));
|
|
6294
6346
|
child.once("error", (error) => done({ code: null, signal: null, error }));
|
|
@@ -6631,6 +6683,7 @@ export {
|
|
|
6631
6683
|
LockBusy,
|
|
6632
6684
|
takeLock,
|
|
6633
6685
|
MAX_SB_BYTES,
|
|
6686
|
+
MAX_TICKET_CHARS,
|
|
6634
6687
|
SHA_RE,
|
|
6635
6688
|
isName,
|
|
6636
6689
|
isObject2 as isObject,
|
package/dist/server/cli.mjs
CHANGED
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
writeBoard,
|
|
87
87
|
writeJson,
|
|
88
88
|
writerAlive
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-PQZBUOCK.mjs";
|
|
90
90
|
|
|
91
91
|
// src/server/cli.ts
|
|
92
92
|
import { existsSync as existsSync2, realpathSync as realpathSync2 } from "node:fs";
|
|
@@ -294,7 +294,7 @@ function check(flags, io) {
|
|
|
294
294
|
const exists = io.exists ?? ((path) => existsSync(resolve3(cwd, path)));
|
|
295
295
|
const isAncestor = io.isAncestor ?? ((older, newer2) => {
|
|
296
296
|
try {
|
|
297
|
-
execFileSyncExe("git", ["merge-base", "--is-ancestor", older, newer2], { cwd, stdio: "ignore", timeout: 15e3 });
|
|
297
|
+
execFileSyncExe("git", ["merge-base", "--is-ancestor", older, newer2], { cwd, stdio: "ignore", timeout: 15e3, killSignal: "SIGKILL" });
|
|
298
298
|
return true;
|
|
299
299
|
} catch {
|
|
300
300
|
return false;
|