fix(hooks): pass the Windows cmd /C command line via raw_arg — Command::arg's CRT-style quoting inserted literal \" into hook commands, which cmd.exe does not unescape, so JSON decisions never parsed (hook_gate_* Windows failures)

Co-Authored-By: Claude <noreply@anthropic.com>
https://claude.ai/code/session_018zaP8vUfTAsrE38L6h6fw5
This commit is contained in:
Claude
2026-06-11 04:46:05 +00:00
parent 6f5039101a
commit 1a61a79910
+4 -1
View File
@@ -626,8 +626,11 @@ impl HookExecutor {
fn build_shell_command(command: &str) -> Command {
#[cfg(windows)]
{
use std::os::windows::process::CommandExt as _;
let mut cmd = Command::new("cmd");
cmd.arg("/C").arg(command);
// raw_arg: cmd.exe does not parse the CRT-style \" escapes that
// Command::arg would insert, so pass the command line verbatim.
cmd.arg("/C").raw_arg(command);
cmd
}
#[cfg(not(windows))]