mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-10-19 02:10:57 +00:00
fix(opencode): preserve OCR output on Windows (#1606)
Some checks failed
CI / cross-compile (amd64, darwin) (push) Has been cancelled
CI / cross-compile (arm64, darwin) (push) Has been cancelled
CI / cross-compile (arm64, linux) (push) Has been cancelled
CI / test (push) Has been cancelled
CI / cross-compile (amd64, windows) (push) Has been cancelled
CI / windows (push) Has been cancelled
CI / cross-compile (arm64, windows) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
plugin-contract / plugin-contract (push) Has been cancelled
CodeQL Advanced / Analyze (go) (push) Has been cancelled
Some checks failed
CI / cross-compile (amd64, darwin) (push) Has been cancelled
CI / cross-compile (arm64, darwin) (push) Has been cancelled
CI / cross-compile (arm64, linux) (push) Has been cancelled
CI / test (push) Has been cancelled
CI / cross-compile (amd64, windows) (push) Has been cancelled
CI / windows (push) Has been cancelled
CI / cross-compile (arm64, windows) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
plugin-contract / plugin-contract (push) Has been cancelled
CodeQL Advanced / Analyze (go) (push) Has been cancelled
Co-authored-by: Kite <254839944+lizhengfeng101@users.noreply.github.com>
This commit is contained in:
parent
35fc3e259d
commit
357c3f09a2
2 changed files with 19 additions and 1 deletions
|
|
@ -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(
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue