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
..
2026-11-17 15:55:01 +00:00
2026-11-24 03:55:44 +00:00
2026-11-18 15:38:06 +00:00
2026-11-25 06:19:21 +00:00
2026-11-25 22:46:26 +00:00
2026-11-23 02:13:58 +00:00
2026-11-20 07:14:27 +00:00
2026-11-25 14:03:11 +00:00
2026-11-23 14:45:38 +00:00
2026-11-18 07:43:45 +00:00
2026-11-25 12:07:36 +00:00
2026-11-23 22:40:20 +00:00
2026-11-18 07:23:25 +00:00
2026-11-17 13:38:34 +00:00
2026-11-25 02:31:54 +00:00
2026-11-13 04:48:28 +00:00
2026-11-24 17:32:08 +00:00
2026-11-25 22:46:26 +00:00
2026-11-23 02:13:58 +00:00
2026-11-25 00:44:23 +00:00
2026-11-24 04:49:27 +00:00
2026-11-24 23:39:47 +00:00
2026-11-24 20:21:47 +00:00
2026-11-24 23:39:47 +00:00
2026-11-25 02:31:54 +00:00
2026-11-24 00:14:14 +00:00
2026-11-24 14:18:12 +00:00
2026-11-25 16:07:45 +00:00
2026-11-18 20:42:18 +00:00
2026-11-24 23:55:40 +00:00
2026-11-25 22:53:41 +00:00
2026-11-25 14:03:11 +00:00
2026-11-13 20:23:24 +00:00
2026-11-24 03:13:18 +00:00
2026-11-24 23:57:49 +00:00
2026-11-25 22:46:26 +00:00
2026-11-23 05:39:53 +00:00
2026-11-19 22:32:56 +00:00
2026-11-19 22:32:56 +00:00
2026-11-25 22:42:49 +00:00
2026-11-24 23:57:49 +00:00
2026-11-25 22:41:36 +00:00
2026-11-23 02:01:17 +00:00
2026-11-14 02:45:51 +00:00
2026-11-23 05:39:53 +00:00
2026-11-23 17:26:33 +00:00
2026-11-25 14:22:54 +00:00
2026-11-24 21:10:00 +00:00
2026-11-25 22:53:41 +00:00
2026-11-25 22:47:37 +00:00
2026-11-24 05:32:26 +00:00
2026-11-25 00:12:21 +00:00
2026-11-25 02:30:37 +00:00
2026-11-24 23:57:49 +00:00
2026-11-19 16:44:44 +00:00
2026-11-24 20:21:47 +00:00
2026-11-24 13:50:12 +00:00
2026-11-25 02:30:37 +00:00
2026-11-24 00:14:14 +00:00
2026-11-25 02:29:04 +00:00
2026-11-19 06:18:44 +00:00
2026-11-25 16:09:51 +00:00
2026-11-25 16:09:51 +00:00
2026-11-25 06:38:46 +00:00
2026-11-17 21:40:36 +00:00
2026-11-24 03:56:24 +00:00
2026-11-24 20:21:47 +00:00
2026-11-25 16:09:51 +00:00
2026-11-18 18:11:54 +00:00
2026-11-25 22:52:27 +00:00
2026-11-25 22:42:11 +00:00
2026-11-21 04:35:37 +00:00
2026-11-23 12:52:50 +00:00
2026-11-24 21:27:17 +00:00
2026-11-18 19:21:39 +00:00
2026-11-13 23:15:54 +00:00
2026-11-24 19:56:22 +00:00
2026-11-25 22:51:53 +00:00
2026-11-24 17:03:35 +00:00
2026-11-24 23:15:42 +00:00
2026-11-18 04:16:11 +00:00
2026-11-24 20:50:04 +00:00
2026-11-20 01:20:38 +00:00
2026-11-21 01:40:15 +00:00
2026-11-25 15:38:14 +00:00
2026-11-21 03:14:33 +00:00
2026-11-25 14:34:40 +00:00
2026-11-25 22:51:53 +00:00
2026-11-17 04:08:00 +00:00
2026-11-17 20:05:26 +00:00
2026-11-25 12:06:53 +00:00
2026-11-13 18:51:30 +00:00
2026-11-22 18:09:39 +00:00
2026-11-23 15:12:35 +00:00
2026-11-25 15:19:27 +00:00
2026-11-20 23:45:24 +00:00
2026-11-12 23:53:50 +00:00
2026-11-13 22:18:01 +00:00
2026-11-25 22:46:26 +00:00
2026-11-25 16:09:51 +00:00
2026-11-17 15:55:01 +00:00