Skip to content

fix(hooks): handle closed output pipes without failing - #956

Open
rudycelekli wants to merge 1 commit into
DietrichGebert:mainfrom
rudycelekli:fix/hooks-handle-closed-output-20261001
Open

rudycelekli wants to merge 1 commit into
DietrichGebert:mainfrom
rudycelekli:fix/hooks-handle-closed-output-20261001

Conversation

@rudycelekli

Copy link
Copy Markdown

When a host closes a lifecycle hook’s stdout pipe, Node reports EPIPE through an asynchronous stream error. The existing try/catch guards cannot catch it, so activation and mode tracking exit with an unhandled error instead of completing quietly.

Handle EPIPE once in the shared runtime and keep all other output errors visible. A subprocess regression closes a real output pipe for both hooks, checks ordinary output, and confirms that a non-EPIPE error still fails.

Validation: rule-copy and version checks passed; npm test passed (97 root, 23 Pi, 3 MCP tests). The closed-pipe regression fails on unchanged main with exit 1 and write EPIPE. Verified with Node 22.19.0 on macOS; Windows was not run locally.

Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant