Skip to content

fix: render the TUI on the tty when stdout is piped - #338

Merged
umputun merged 4 commits into
masterfrom
fix-stdout-pipe-hang
Aug 28, 2026
Merged

fix: render the TUI on the tty when stdout is piped#338
umputun merged 4 commits into
masterfrom
fix-stdout-pipe-hang

Conversation

@umputun

@umputun umputun commented Aug 28, 2026

Copy link
Copy Markdown
Owner

revdiff HEAD~1 | pbcopy never 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 checkResize returns early, no WindowSizeMsg is ever sent, Model.ready never flips, and View returns loading... for the life of the process.

fix: when stdout is not a terminal, open /dev/tty write-only and hand that to tea.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_RedirectedStdoutUsesTTY covers it end to end: it runs the test binary inside a script pty with stdout piped through cat, watches the live terminal transcript through a FIFO for the alt-screen enter sequence, sends q, then asserts the captured stdout is exactly the annotation block with no ANSI in it. Deleting the tea.WithOutput line makes it fail.

three other commits ride along:

  • race timeout raised from 100s to 180s in the Makefile and CI. The app package measured between 76.9s and 96.5s concurrently depending on load and coverage, against a 100s limit. docs/backlog/race-timeout-budget-too-tight.md asked for this and is deleted here.
  • five errors.As to errors.AsType rewrites, so full lint is back to zero.
  • a backlog note that the --post-flush-command clipboard route is undocumented, found while looking at Make it easier to copy all annotations #336.

Related to #336.

Copilot AI lite review requested due to automatic review settings August 28, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@umputun
umputun merged commit 57a70d2 into master Aug 28, 2026
6 of 7 checks passed
@umputun
umputun deleted the fix-stdout-pipe-hang branch August 28, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants