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:
parent
3ba54c1c31
commit
ea2bd2a0a2
@ -133,7 +133,7 @@ class DeprecationErrorHandler
|
|||||||
private static function hasColorSupport()
|
private static function hasColorSupport()
|
||||||
{
|
{
|
||||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
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);
|
return defined('STDOUT') && function_exists('posix_isatty') && @posix_isatty(STDOUT);
|
||||||
|
@ -448,7 +448,7 @@ class CliDumper extends AbstractDumper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
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')) {
|
} elseif (function_exists('posix_isatty')) {
|
||||||
$h = stream_get_meta_data($this->outputStream) + array('wrapper_type' => null);
|
$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;
|
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream;
|
||||||
|
Reference in New Issue
Block a user