Repository navigation
fix(core): ignore late EPIPE on stdin in the cross-spawn spawner - #393
Merged
Merged
Conversation
filipeforattini
enabled auto-merge (squash)
September 23, 2026 18:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The HookV2 tests in
packages/core/test/hook.test.tsfailed again withEPIPE: broken pipe, writeafter #360. This was the first CI attempt of PR #378: run 35824326717, attempt 1, job 107062725644. The stack shows where it comes from:Bun keeps a small stdin write buffered in its FileSink and flushes it only when the stream is destroyed after
end()(autoDestroy onfinish). If the hook exits without reading its input, that flush fails with EPIPE. By then the stdin sink has completed and removed its error listener, so the stream'serrorevent has no listener and becomes an uncaught exception.#360 fixed this only in
@effect/platform-node-shared'sNodeChildProcessSpawner. Core does not use that spawner.AppProcess(and soHookV2.executeCommand) runs onCrossSpawnSpawnerinpackages/core/src/cross-spawn-spawner.ts, which has its own copy ofsetupStdinwithout the listener.I reproduced it locally with a short Bun script: a child that closes fd 0, then
stdin.write(small)andend(). It raises the same uncaught EPIPE with the same stack on every run.Fix
CrossSpawnSpawner.setupStdinnow attaches a no-operrorlistener to the child's stdin, the same as the fix(core): ignore late EPIPE from hook stdin #360 patch. The sink still reports errors while it is attached.packages/core/test/effect/cross-spawn-spawner.test.ts. The child closes its stdin and reports it on stdout. Only then does the stdin stream emit its JSON payload. The test fails if any uncaught exception is recorded.Validation
CI only.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.