Version
v4.7.0 (verified on tag v4.7.0, 2026-06-18)
Problem
hooks/ponytail-mode-tracker.js lines 9-10 register stdin.on('data') and stdin.on('end') with no stdin.on('error') handler.
When stdin closes abnormally (broken pipe, parent crash), Node emits an unhandled error event on the stream. Without a listener this becomes an uncaught exception, crashing the hook process with a non-zero exit code.
Code
javascript let input = ''; process.stdin.on('data', chunk => { input += chunk; }); process.stdin.on('end', () => { // ... no stdin.on('error') handler
Fix
javascript process.stdin.on('error', () => { process.exit(0); }); let input = ''; process.stdin.on('data', chunk => { input += chunk; }); process.stdin.on('end', () => { ... });
process.exit(0) keeps the hook contract: always exit 0, never block session start.
Severity
HIGH - Unhandled stream error ? uncaught exception ? hook crashes non-zero
Version
v4.7.0 (verified on tag v4.7.0, 2026-06-18)
Problem
hooks/ponytail-mode-tracker.jslines 9-10 registerstdin.on('data')andstdin.on('end')with nostdin.on('error')handler.When stdin closes abnormally (broken pipe, parent crash), Node emits an unhandled
errorevent on the stream. Without a listener this becomes an uncaught exception, crashing the hook process with a non-zero exit code.Code
javascript let input = ''; process.stdin.on('data', chunk => { input += chunk; }); process.stdin.on('end', () => { // ... no stdin.on('error') handlerFix
javascript process.stdin.on('error', () => { process.exit(0); }); let input = ''; process.stdin.on('data', chunk => { input += chunk; }); process.stdin.on('end', () => { ... });process.exit(0)keeps the hook contract: always exit 0, never block session start.Severity
HIGH - Unhandled stream error ? uncaught exception ? hook crashes non-zero