From ea2bd2a0a2da17a36c277123722b3e49be67789d Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 26 Sep 2015 13:46:24 +0200 Subject: [PATCH] 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). --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 2 +- src/Symfony/Component/VarDumper/Dumper/CliDumper.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 42d88b030d..063723d32d 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -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); diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 1fcad90c87..cbdef90dd4 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -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;