fix(opencode): preserve OCR output on Windows (#1606)

Co-authored-by: Kite <[email protected]>
This commit is contained in:
OUAO-FRANKandKite authored and GitHub committed 2026-10-10 16:37:26 +08:00
1 parent 35fc3e259d
commit 357c3f09a2
2 files changed
+19 -1

No files matched your search

@@ -178,7 +178,7 @@ async function runOcr(args: string[], options: RunOptions): Promise<RunResult> {
cwd: options.cwd,
env: process.env,
shell: false,
detached: true,
detached: process.platform !== "win32",
},
)
child.stdin.end()
@@ -358,6 +358,24 @@ test("ocr_review reports non-zero exits with OCR output", async () => {
)
})
test("ocr_review preserves output from the Windows command shim", { skip: process.platform !== "win32" }, async () => {
await withFakeOcr(
"console.error('windows shim output'); process.exit(7)",
async (worktree) => {
const { hooks } = await loadPlugin(worktree)
await assert.rejects(
hooks.tool.ocr_review.execute({}, toolContext(worktree)),
(error) => {
assert.equal(error.name, "OcrExecutionError")
assert.equal(error.exitCode, 7)
assert.match(error.message, /windows shim output/)
return true
},
)
},
)
})
test("ocr_review removes its temporary background after a non-zero exit", async () => {
await withFakeOcr(
[