Q59: a signal-killed command is reported as failed, not exit code 0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 10:20:54 -04:00
1 parent a3aee1940a
commit 8775c34650
2 files changed
+19 -4

No files matched your search

+10 -1
View File
@@ -2,7 +2,7 @@ import { mkdtempSync, readFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, test, vi } from "vitest";
import { BoundedOutput, runCommand } from "../../src/main/services/workspace-command";
import { BoundedOutput, formatCommandResult, runCommand } from "../../src/main/services/workspace-command";
import { stopRun, withRunControl } from "../../src/main/services/run-control";
describe("bounded command output", () => {
@@ -66,3 +66,12 @@ describe("run_command and run stops", () => {
warn.mockRestore();
});
});
describe("command results", () => {
test("a signal-terminated command is reported as killed, never as exit code 0", () => {
expect(formatCommandResult(0, null, "built")).toBe("exit code 0\nbuilt");
expect(formatCommandResult(2, null, "")).toBe("exit code 2\n(no output)");
expect(formatCommandResult(null, "SIGKILL", "partial")).toBe("ERROR: the command was killed by SIGKILL before it exited; treat it as failed.\npartial");
expect(formatCommandResult(null, null, "")).toBe("ERROR: the command ended without an exit code; treat it as failed.\n(no output)");
});
});