Disable in-place progress bar redraw on non-interactive output#11
Merged
Conversation
Symfony's ProgressBar animates in place whenever the output is decorated, which --ansi forces on even when no real terminal is attached. The in-place redraw emits cursor-control escape sequences that CI log viewers (e.g. GitLab) do not collapse, leaving every redraw frame stacked into an unreadable wall. Decide the redraw mode from an actual TTY check instead of decoration: on an interactive terminal keep the in-place animation; otherwise fall back to one line per redraw (as PHPStan does) with a lower redraw frequency. Colors are unaffected, so --ansi still produces colored output in CI. Co-Authored-By: Claude Code
Co-Authored-By: Claude Code
janedbal
marked this pull request as ready for review
June 2, 2026 13:43
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
Running the detector in CI with
--ansiproduces an unreadable wall of stacked progress bars:Symfony's
ProgressBaranimates the bar in place whenever the output is decorated — and--ansiforces decoration on, even when no real terminal is attached (ProgressBar::start()only disables overwrite when!isDecorated()). The in-place redraw emits cursor-control escape sequences (\x1B[1G,\x1B[2K) to overwrite the line. CI log viewers like GitLab don't collapse those sequences, so every redraw frame is appended, stacking ~50 partial bars into one wrapped blob.PHPStan (which also uses Symfony Console with
--ansi) doesn't suffer this because it emits one line per progress step in non-interactive output rather than animating in place.Fix
Decide the redraw mode from an actual TTY check (
stream_isatty) instead of from decoration:setOverwrite(false)so each redraw is its own line, plus a lower redraw frequency to keep the log compact (~10 lines, PHPStan-style).Colors are untouched —
--ansistill produces colored output in CI.Verification
Before (piped,
--ansi): cursor-control sequences interleaved, frames stacked.After (piped,
--ansi): clean newline-separated lines, no cursor escapes:composer checkpasses (cs, phpstan, coverage, tests).Co-Authored-By: Claude Code