8000 bug #15915 Detect Mintty for color support on Windows (stof) · symfony/symfony@4a89355 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4a89355

Browse files
committed
bug #15915 Detect Mintty for color support on Windows (stof)
This PR was submitted for the 2.8 branch but it was merged into the 2.3 branch instead (closes #15915). Discussion ---------- Detect Mintty for color support on Windows | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | symfony/symfony-docs#5726 Mintty is now the default terminal in GitBash, and it supports ANSI colors without the need of ANSICON (it even supports 256 colors rather than the 16 colors supported by ANSICON). I submitted it to 2.8 as it can be considered as a new feature. But it should not be hard to merge it in other branches if we decide to consider it as a bugfix (it just needs to be split because VarDumper does not exist in 2.3) Commits ------- 12743d1 Detect Mintty for color support on Windows
2 parents 8df5d94 + 12743d1 commit 4a89355

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function doWrite($message, $newline)
8989
*
9090
* Colorization is disabled if not supported by the stream:
9191
*
92-
* - Windows without Ansicon and ConEmu
92+
* - Windows without Ansicon, ConEmu or Mintty
9393
* - non tty consoles
9494
*
9595
* @return bool true if the stream supports colorization, false otherwise
@@ -98,7 +98,7 @@ protected function hasColorSupport()
9898
{
9999
// @codeCoverageIgnoreStart
100100
if (DIRECTORY_SEPARATOR === '\\') {
101-
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
101+
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
102102
}
103103

104104
return function_exists('posix_isatty') && @posix_isatty($this->stream);

0 commit comments

Comments
 (0)
0