fix(dsh-plugin-browserskill): report interrupt-killed commands as interrupted

A child killed via killFor (overlay interrupt) exits with a null code
and empty output, which used to render as a duplicated 'bsk x failed:
bsk x failed'. Report it as interrupted instead.
This commit is contained in:
BB-fat committed 2026-08-14 07:01:44 +00:00
1 parent e2d07574d7
commit dde707b558
2 files changed
+9

No files matched your search

@@ -187,6 +187,11 @@ export function parseBskJson(result: BskRunResult, commandLabel: string): unknow
throw new BskError(`bsk ${commandLabel} timed out`, { timedOut: true }); throw new BskError(`bsk ${commandLabel} timed out`, { timedOut: true });
} }
const body = result.stdout.trim(); const body = result.stdout.trim();
// Killed by our own interrupt (SIGTERM from killFor), not by the abort path:
// say so instead of doubling the generic label into the message.
if (result.code === null && !result.aborted && !result.timedOut) {
throw new BskError(`bsk ${commandLabel} was interrupted (process killed)`);
}
if (result.code !== 0) { if (result.code !== 0) {
let parsed: BskErrorBody | undefined; let parsed: BskErrorBody | undefined;
try { try {
@@ -117,6 +117,10 @@ describe("parseBskJson", () => {
expect(() => parseBskJson({ ...base, code: 1, stderr: "boom" }, "x")).toThrow(/boom/); expect(() => parseBskJson({ ...base, code: 1, stderr: "boom" }, "x")).toThrow(/boom/);
}); });
it("reports killed-by-interrupt children (null exit code) as interrupted", () => {
expect(() => parseBskJson({ ...base, code: null }, "navigate")).toThrow(/interrupted/);
});
it("reports timeouts distinctly", () => { it("reports timeouts distinctly", () => {
expect(() => parseBskJson({ ...base, timedOut: true }, "x")).toThrow(/timed out/); expect(() => parseBskJson({ ...base, timedOut: true }, "x")).toThrow(/timed out/);
}); });