diff --git a/plugins/open-code-review/opencode/open-code-review.ts b/plugins/open-code-review/opencode/open-code-review.ts index bc5fd2b..63d0f26 100644 --- a/plugins/open-code-review/opencode/open-code-review.ts +++ b/plugins/open-code-review/opencode/open-code-review.ts @@ -178,7 +178,7 @@ async function runOcr(args: string[], options: RunOptions): Promise { cwd: options.cwd, env: process.env, shell: false, - detached: true, + detached: process.platform !== "win32", }, ) child.stdin.end() diff --git a/plugins/open-code-review/opencode/test/open-code-review.test.mjs b/plugins/open-code-review/opencode/test/open-code-review.test.mjs index 780514b..629e983 100644 --- a/plugins/open-code-review/opencode/test/open-code-review.test.mjs +++ b/plugins/open-code-review/opencode/test/open-code-review.test.mjs @@ -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( [