Replace shared subprocessStderr with per-subprocess pipes#17
Open
Replace shared subprocessStderr with per-subprocess pipes#17
Conversation
This test runs a snapshot with --cmd that writes to both stdout and stderr. It currently documents a bug: subprocessStderr is closed before runPostUnpackCmd runs, causing hDuplicate to fail with "Bad file descriptor". Co-Authored-By: Claude Opus 4.6 <[email protected]>
The shared subprocessStderr pipe caused "Bad file descriptor" crashes when runPostUnpackCmd or RemoteCache.saveCache tried to write after the pipe's write-end was closed. Instead of shuffling close timing, each subprocess now creates its own pipe via withStderrPipe, reads/prefixes its output, and cleans up independently. - Remove subprocessStderr field from AppState - Add withStderrPipe helper to Utils.hs (create-pipe, spawn-handler, run-action, close-and-wait pattern) - Move outputStreamHandler, timeoutStream, ignoreEOF to Utils.hs - Update all callsites: isDirtyAtPaths, getCurrentBranch, getMainBranchCommit, getCurrentCommit, runPostUnpackCmd, hashFileInputs - Update packTar/unpackTar to accept stderr handle parameter - Fix getCurrentCommit TODO (was using raw stderr as workaround) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
zyla
commented
Mar 14, 2026
Collaborator
Author
There was a problem hiding this comment.
This checks if post-unpack-cmd can use stdout and stderr
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.
Summary
withStderrPipehelper: each subprocess creates its own pipe, reads/prefixes output, and cleans up independently — no shared state or lifetime issuesgetCurrentCommitTODO (previously fell back to raw stderr as a workaround for the shared pipe problem)timeoutStreamto before success messages are logged, eliminating output ordering race condition which caused flakiness in tests (e.g. https://github.com/restaumatic/taskrunner/actions/runs/23081371040/job/67051182317)🤖 Generated with Claude Code