8000 bug #15771 [Console] Ensure the console output is only detected as de… · symfony/symfony@e2156d7 · GitHub
[go: up one dir, main page]

Skip to content

Commit e2156d7

Browse files
committed
bug #15771 [Console] Ensure the console output is only detected as decorated when both stderr and stdout support colors (Seldaek)
This PR was merged into the 2.3 branch. Discussion ---------- [Console] Ensure the console output is only detected as decorated when both stderr and stdout support colors | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10592 #13449 | License | MIT | Doc PR | This is a simplified version of #13661 which does not create any issues with having two decorators but merely ensures that if either STDERR **or** STDOUT has colors disabled, then both will have decoration disabled. It's not a perfect solution but it's better than having both enabled as this breaks things. And I don't think we can come to a better solution without api changes. Commits ------- f3d8444 [Console] Ensure the console output is only detected as decorated when both stderr and stdout support colors
2 parents 238531f + f3d8444 commit e2156d7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/Console/Output/ConsoleOutput.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = nu
4848
{
4949
parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
5050

51+
$actualDecorated = $this->isDecorated();
5152
$this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
53+
54+
if (null === $decorated) {
55+
$this->setDecorated($actualDecorated && $this->stderr->isDecorated());
56+
}
5257
}
5358

5459
/**

0 commit comments

Comments
 (0)
0