Skip to content

Commit 0507eeb

Browse files
committed
fix(claude): guard wezterm-notify.sh against TTY input and stdin hangs
Manual invocation blocked forever waiting for stdin EOF, and a Claude Code client bug (anthropics/claude-code#78756) intermittently leaves the hook's stdin pipe open, freezing the whole session. Exit early on a TTY and bound the stdin read to 0.5s.
1 parent 22066e3 commit 0507eeb

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

modules/claude/wezterm-notify.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,18 @@ if [[ -z "$pane_id" || -z "$socket" ]]; then
88
exit 0
99
fi
1010

11-
payload="$(</dev/stdin)"
11+
# Manual/interactive invocation with no piped input would otherwise block
12+
# forever waiting for stdin EOF.
13+
if [[ -t 0 ]]; then
14+
exit 0
15+
fi
16+
17+
# Read with a bounded timeout: a known Claude Code client bug intermittently
18+
# leaves the hook's stdin pipe open (never sends EOF), which would otherwise
19+
# block this read forever and freeze the whole session
20+
# (https://github.com/anthropics/claude-code/issues/78756).
21+
payload=""
22+
IFS= read -r -t 0.5 -d '' payload || true
1223
event="$(
1324
printf '%s' "$payload" | @jq@ -r '.hook_event_name // "unknown"' 2>/dev/null ||
1425
printf 'unknown'

0 commit comments

Comments
 (0)