Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea2bd2a

Browse files
stoffabpot
authored andcommitted
Detect Mintty for color support on Windows
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).
1 parent 3ba54c1 commit ea2bd2a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static function register($mode = false)
133133
private static function hasColorSupport()
134134
{
135135
if ('\\' === DIRECTORY_SEPARATOR) {
136-
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
136+
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
137137
}
138138

139139
return defined('STDOUT') && function_exists('posix_isatty') && @posix_isatty(STDOUT);

src/Symfony/Component/VarDumper/Dumper/CliDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ protected function supportsColors()
448448
}
449449

450450
if ('\\' === DIRECTORY_SEPARATOR) {
451-
static::$defaultColors = @(false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'));
451+
static::$defaultColors = @(false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'));
452452
} elseif (function_exists('posix_isatty')) {
453453
$h = stream_get_meta_data($this->outputStream) + array('wrapper_type' => null);
454454
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream;

0 commit comments

Comments
 (0)