Skip to content

[ax] Disable progress bar when output is not a TTY - #8444

Merged
TomasVotruba merged 1 commit into
mainfrom
no-progress-bar-when-not-tty
Sep 3, 2026
Merged

[ax] Disable progress bar when output is not a TTY#8444
TomasVotruba merged 1 commit into
mainfrom
no-progress-bar-when-not-tty

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Why

Rector is increasingly driven by non-human callers (agents, scripts) and piped/redirected output. In those contexts the progress bar is pure noise - it pollutes captured stdout and forces consumers to strip redraw sequences.

Currently the progress bar shows whenever output format is console and verbosity is normal. Whether the output is an actual terminal is never checked; CiDetector only tunes the redraw rate, it does not turn the bar off.

What

Short-circuit shouldShowProgressBar() to false when STDOUT is not a TTY (piped output, CI, an agent). Interactive terminals are unaffected - the bar shows exactly as before.

if (! $this->isTtyOutput()) {
    return false;
}
private function isTtyOutput(): bool
{
    return defined('STDOUT') && stream_isatty(STDOUT);
}

Behavior change to note

Non-TTY CI logs previously showed a CiDetector-tuned (slow-redraw, non-overwriting) progress bar; they now show none. This is intentional - less log spam - but is a visible change for human CI users, not only agents. --no-progress-bar and verbose modes behaved this way already; a real terminal is unchanged.

CiDetector is left in place for now; a follow-up can remove the redraw tuning that this makes largely redundant.

Tests

  • composer check-cs - clean
  • vendor/bin/phpunit tests/Configuration/ConfigurationFactoryTest.php - green

@TomasVotruba
TomasVotruba merged commit 6f0bf46 into main Sep 3, 2026
43 of 44 checks passed
@TomasVotruba
TomasVotruba deleted the no-progress-bar-when-not-tty branch September 3, 2026 19:45
@TomasVotruba TomasVotruba changed the title [Console] Disable progress bar when output is not a TTY [ax] Disable progress bar when output is not a TTY Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant