fix: sync stderr after command completion to fix CI flake#95
Merged
Conversation
Adds a __HERMES_STDBUF_N__ marker written to stderr after each user command in the execution frame. Run() spins until the marker appears in stderrBuf before reading the stderr delta. This fixes a race where the END marker on stdout signals completion before the stderr pipe has finished delivering the command's output. On CI (no TTY), bash -i echoes the input frame to stderr, which arrives via a separate pipe — the sync marker ensures captureStderr has flushed everything before Run reads the buffer. Fixes TestRunStderrScopedPerCommand flake on GitHub Actions runners. Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
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.
Problem
TestRunStderrScopedPerCommandflakes on GitHub Actions CI (no TTY) becausebash -iechoes the input frame to stderr while stdout/stderr are separate pipes. The END marker on stdout can signal completion before the stderr pipe has finished delivering the command's output, causing stderr from cmd1 to leak into cmd2's captured stderr.Fix
__HERMES_STDBUF_N__marker to the execution frame, written to stderr after every user commandstderrBufbefore reading the stderr deltaTesting
TestRunStderrScopedPerCommandpasses 10/10 runs locallyinternal/exec/suite passes