fix: prevent Windows session freeze from stdin EOF deadlock (#477)
On Windows, Claude Code runs the UserPromptSubmit hook through a PowerShell
if {} wrapper that can swallow the piped prompt JSON, so stdin 'end' never
fires and ponytail-mode-tracker.js blocks forever, freezing the session.
Make the hook non-blocking: extract the handler into finish() guarded by a
done flag, and add a 1s unref()'d fallback timeout plus the existing stdin
error handler that both call finish() then exit 0. unref() means zero added
latency on the normal path where 'end' fires first. Adds a regression test
that spawns the hook with a never-closing stdin pipe and asserts self-exit.
Reconciles #453 onto main after #227 (stdin error handler) and #474 (exec
node hooks) landed.
Closes #443
Co-authored-by: Hasnan42 <154899774+Hasnan42@users.noreply.github.com> D
DietrichGebert committed
7e6eca6e29abb50f50cad2c2a895fe619ee11a8f
Parent: b8f6fbe
Committed by GitHub <noreply@github.com>
on 7/1/2026, 10:18:01 PM