Files
codex/codex-rs
Eric Traut 653def34fb Preserve native exit codes in Windows PowerShell hooks (#64013)
## Why

PowerShell's `-Command` can report a native command's exit code `2` as
`1`, so a `PreToolUse` hook can fail to block a tool call.

## What changed

Use `$?` to preserve successful hook results and forward
`$LASTEXITCODE` on failure when available. Pass scripts with named
blocks through as written because PowerShell forbids trailing
top-level statements after those blocks.

## Testing

Add Windows regression coverage for a native command and a PowerShell
`end` block that each exit with code `2`. Both cases check that
`PreToolUse` denies `apply_patch` before approval, reports the denial
reason, and leaves the target file uncreated.

GitOrigin-RevId: 9668b1382bb56f168794dd8d4d2fecac13d2f649
2026-11-25 22:53:41 +00:00
..
…
…
…