Skip to content

Commit 6f0bf46

Browse files
authored
[Console] Disable progress bar when output is not a TTY (#8444)
1 parent 9c946ac commit 6f0bf46

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎src/Configuration/ConfigurationFactory.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,23 @@ private function shouldShowProgressBar(InputInterface $input, string $outputForm
150150
return false;
151151
}
152152

153+
// no interactive terminal, e.g. piped output, CI or an agent - the redraws are just noise
154+
if (! $this->isTtyOutput()) {
155+
return false;
156+
}
157+
153158
if ($this->symfonyStyle->isVerbose()) {
154159
return false;
155160
}
156161

157162
return $outputFormat === ConsoleOutputFormatter::NAME;
158163
}
159164

165+
private function isTtyOutput(): bool
166+
{
167+
return defined('STDOUT') && stream_isatty(STDOUT);
168+
}
169+
160170
private function shouldShowDiffs(InputInterface $input): bool
161171
{
162172
$noDiffs = (bool) $input->getOption(Option::NO_DIFFS);

0 commit comments

Comments
 (0)