fix(hooks): replace run-hook.cmd heredoc with :; label lines (#571)

bash >= 5.1 writes heredocs into a pipe pre-fork; under macOS pipe
pressure the kernel hands out 512-byte pipes and the wrapper's 1.4KB
CMDBLOCK heredoc deadlocks every hook. Label lines parse nowhere:
cmd.exe skips them as labels, POSIX shells exec away before the batch
block. Also: silent fail-open when bash or the script name is missing,
and CDPATH-proof directory resolution.
This commit is contained in:
Drew Ritter
2026-08-05 15:12:47 -07:00
parent 431915accb
commit d80fc1808a
2 changed files with 24 additions and 11 deletions

View File

@@ -184,6 +184,15 @@ assert_command_output \
CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \
bash "$WRAPPER_UNDER_TEST" session-start
# With no bash available, the wrapper must fail open: silent, exit 0.
if output="$(env -i PATH=/nonexistent /bin/sh "$WRAPPER_UNDER_TEST" session-start 2>&1)" \
&& [ -z "$output" ]; then
pass "wrapper with no bash on PATH is silent and exits 0"
else
fail "wrapper with no bash on PATH is silent and exits 0"
printf '%s\n' "$output" | head -3 | sed 's/^/ /'
fi
cursor_home="$(make_home cursor)"
assert_command_output \
"Cursor emits top-level additional_context only" \