From c30854118ecc2542c559623d98976d48cb07f2ee Mon Sep 17 00:00:00 2001 From: Lakshya77089 <169168095+Lakshya77089@users.noreply.github.com> Date: Fri, 19 Jun 2026 02:20:13 +0530 Subject: [PATCH] fix: guard final writeHookOutput against stdout EPIPE in ponytail-activate (#149) (#152) The final writeHookOutput('SessionStart', ...) call was the only operation in the file outside a try/catch. writeHookOutput ends in a bare process.stdout.write, so a closed stdout / broken pipe (EPIPE) at hook exit throws uncaught and crashes the hook with a non-zero exit code. Wrap it to match the file's existing never-block-session-start posture. --- hooks/ponytail-activate.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hooks/ponytail-activate.js b/hooks/ponytail-activate.js index 51aca92..b44251d 100644 --- a/hooks/ponytail-activate.js +++ b/hooks/ponytail-activate.js @@ -71,4 +71,8 @@ if (!isCodex) try { // Silent fail — don't block session start over statusline detection } -writeHookOutput('SessionStart', mode, output); +try { + writeHookOutput('SessionStart', mode, output); +} catch (e) { + // Silent fail — stdout closed/EPIPE at hook exit must not surface as a hook failure +}