fix: render the TUI on the tty when stdout is piped - #338
Merged
Conversation
This was referenced Aug 28, 2026
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.
revdiff HEAD~1 | pbcopynever renders. It sits in the loading state forever, and the README's first line advertises piping stdout as a supported workflow.cause: revdiff renders the TUI to stdout. When stdout is redirected bubbletea does not see its output as a terminal, so
checkResizereturns early, noWindowSizeMsgis ever sent,Model.readynever flips, andViewreturnsloading...for the life of the process.fix: when stdout is not a terminal, open
/dev/ttywrite-only and hand that totea.WithOutput. The TUI paints on the terminal and the final annotations still go down the pipe, which is what the README promises. With no controlling terminal at all the open fails and revdiff exits saying it needs one, instead of hanging on a blank screen.TestRun_RedirectedStdoutUsesTTYcovers it end to end: it runs the test binary inside ascriptpty with stdout piped throughcat, watches the live terminal transcript through a FIFO for the alt-screen enter sequence, sendsq, then asserts the captured stdout is exactly the annotation block with no ANSI in it. Deleting thetea.WithOutputline makes it fail.three other commits ride along:
apppackage measured between 76.9s and 96.5s concurrently depending on load and coverage, against a 100s limit.docs/backlog/race-timeout-budget-too-tight.mdasked for this and is deleted here.errors.Astoerrors.AsTyperewrites, so full lint is back to zero.--post-flush-commandclipboard route is undocumented, found while looking at Make it easier to copy all annotations #336.Related to #336.