summaryrefslogtreecommitdiff
path: root/tests/opencode
diff options
context:
space:
mode:
authorJesse Vincent <jesse@primeradiant.com>2026-05-23 16:55:46 -0700
committerJesse Vincent <jesse@primeradiant.com>2026-05-23 16:55:46 -0700
commitf36bad5b78d04c7aaef7f9f45df92d6734c02e73 (patch)
tree5be39f48ba1fed3d5ffc7e0ce14dff9787b25023 /tests/opencode
parent21ad401e909d7b5e4b0f48f5111669ea87118d11 (diff)
Pipe SessionStart hook printf through cat to absorb EPIPE on Windows
On Windows + Git Bash, the SessionStart hook prints a confusing diagnostic at every startup ("printf: write error: Permission denied") when Claude Code closes the hook's stdout pipe before the printf has finished writing. The hook still runs to completion and context still gets injected, but the diagnostic surfaces every session because Git Bash's printf reports EPIPE as "Permission denied" (not "Broken pipe" like Linux) and our `set -euo pipefail` lets that error escape. Piping each printf through `cat` makes the external cat process the recipient of any SIGPIPE / EPIPE. cat's failure does not propagate to the parent bash under pipefail because cat is the last command in the pipeline and exits cleanly when the pipe stays open long enough to hold the data. On macOS/Linux the cat passthrough is transparent (no behavior change, no measurable cost). Verified: - Existing tests/hooks/test-session-start.sh: 7/7 pass on macOS - Manual run on Windows 11 + Git Bash 5.2 + Node 22 produces valid JSON, clean stderr, and exit 0 - JSON output is byte-identical to the unpatched hook Reported by @silvertakana in #1612, attribution preserved in the Co-authored-by trailer below — this is the same fix shape the original PR proposed. Co-authored-by: silvertakana <silvertakana@users.noreply.github.com> Closes #1612.
Diffstat (limited to 'tests/opencode')
0 files changed, 0 insertions, 0 deletions