From dde707b55888732eff1ba2a271c23149879df3b6 Mon Sep 17 00:00:00 2001 From: BB-fat <1056871944@qq.com> Date: Fri, 14 Aug 2026 07:01:44 +0000 Subject: [PATCH] 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. --- packages/dsh-plugin-browserskill/src/runner.ts | 5 +++++ packages/dsh-plugin-browserskill/tests/runner.test.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/packages/dsh-plugin-browserskill/src/runner.ts b/packages/dsh-plugin-browserskill/src/runner.ts index 7a2dca7..023e2f0 100644 --- a/packages/dsh-plugin-browserskill/src/runner.ts +++ b/packages/dsh-plugin-browserskill/src/runner.ts @@ -187,6 +187,11 @@ export function parseBskJson(result: BskRunResult, commandLabel: string): unknow throw new BskError(`bsk ${commandLabel} timed out`, { timedOut: true }); } 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) { let parsed: BskErrorBody | undefined; try { diff --git a/packages/dsh-plugin-browserskill/tests/runner.test.ts b/packages/dsh-plugin-browserskill/tests/runner.test.ts index dabe046..52d3dac 100644 --- a/packages/dsh-plugin-browserskill/tests/runner.test.ts +++ b/packages/dsh-plugin-browserskill/tests/runner.test.ts @@ -117,6 +117,10 @@ describe("parseBskJson", () => { 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", () => { expect(() => parseBskJson({ ...base, timedOut: true }, "x")).toThrow(/timed out/); });