From f5f695329400a98ad3db7d5e6c5878da4c2091ee Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 26 Sep 2026 12:11:21 -0700 Subject: Explain why session-start pipes printf through cat Three open PRs (#2115, #2349, #2367) removed the | cat pipes as no-op subprocess spawns, which would bring back the Windows EPIPE diagnostic fixed in d72560e (#1612). Say so next to the code. --- hooks/session-start | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hooks/session-start b/hooks/session-start index 083cb23..ffafd64 100755 --- a/hooks/session-start +++ b/hooks/session-start @@ -36,6 +36,14 @@ session_context="\nYou have superpowers.\n\n**Below is the # # Uses printf instead of heredoc to work around bash 5.3+ heredoc hang. # See: https://github.com/obra/superpowers/issues/571 +# +# Each printf is piped through `cat` on purpose, to absorb EPIPE on Windows. +# On Windows + Git Bash, the harness can close the hook's stdout before +# printf finishes, and Git Bash's printf reports that EPIPE as +# "printf: write error: Permission denied", which `set -euo pipefail` lets +# escape as a startup diagnostic every session. Letting cat receive the +# EPIPE keeps it out of the hook's error path. Keep the `| cat` even when +# trimming subprocess spawns. See: https://github.com/obra/superpowers/issues/1612 if [ -n "${CURSOR_PLUGIN_ROOT:-}" ]; then # Cursor sets CURSOR_PLUGIN_ROOT (may also set CLAUDE_PLUGIN_ROOT) printf '{\n "additional_context": "%s"\n}\n' "$session_context" | cat -- cgit