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).
This commit is contained in:
Christophe Coevoet 2015-09-26 13:46:24 +02:00 committed by Fabien Potencier
parent 3ba54c1c31
commit ea2bd2a0a2
2 changed files with 2 additions and 2 deletions

View File

@ -133,7 +133,7 @@ class DeprecationErrorHandler
private static function hasColorSupport()
{
if ('\\' === DIRECTORY_SEPARATOR) {
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
}
return defined('STDOUT') && function_exists('posix_isatty') && @posix_isatty(STDOUT);

View File

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