8000 bug #19660 Disable CLI color for Windows 10 greater than 10.0.10586 (… · symfony/symfony@2909e4b · GitHub
[go: up one dir, main page]

Skip to content

Commit 2909e4b

Browse files
bug #19660 Disable CLI color for Windows 10 greater than 10.0.10586 (mlocati)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #19660). Discussion ---------- Disable CLI color for Windows 10 greater than 10.0.10586 | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #19520 | License | MIT | Doc PR | The command prompt in Windows 10.0.10586 had enabled color support by default. But in the next Windows versions they disabled it ([reference](https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/15617610--re-enable-enable-virtual-terminal-processing-by)): every exe now needs to explicitly turn on the color support. I [already asked](https://bugs.php.net/bug.php?id=72768) the PHP dev team to enable it for php.exe, but they said they are busy for now. So, let's turn off colors for Windows, until we'll have new PHP versions with color support enabled. Commits ------- 255c59f Disable CLI color for Windows 10 greater than 10.0.10586
2 parents 39cd984 + 255c59f commit 2909e4b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private static function hasColorSupport()
161161
{
162162
if ('\\' === DIRECTORY_SEPARATOR) {
163163
return
164-
0 >= version_compare('10.0.10586', PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD)
164+
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
165165
|| false !== getenv('ANSICON')
166166
|| 'ON' === getenv('ConEmuANSI')
167167
|| 'xterm' === getenv('TERM');

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function doWrite($message, $newline)
8383
*
8484
* Colorization is disabled if not supported by the stream:
8585
*
86-
* - Windows before 10.0.10586 without Ansicon, ConEmu or Mintty
86+
* - Windows != 10.0.10586 without Ansicon, ConEmu or Mintty
8787
* - non tty consoles
8888
*
8989
* @return bool true if the stream supports colorization, false otherwise
@@ -92,7 +92,7 @@ protected function hasColorSupport()
9292
{
9393
if (DIRECTORY_SEPARATOR === '\\') {
9494
return
95-
0 >= version_compare('10.0.10586', PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD)
95+
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
9696
|| false !== getenv('ANSICON')
9797
|| 'ON' === getenv('ConEmuANSI')
9898
|| 'xterm' === getenv('TERM');

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

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

450450
if ('\\' === DIRECTORY_SEPARATOR) {
451451
static::$defaultColors = @(
452-
0 >= version_compare('10.0.10586', PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD)
452+
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
453453
|| false !== getenv('ANSICON')
454454
|| 'ON' === getenv('ConEmuANSI')
455455
|| 'xterm' === getenv('TERM')

0 commit comments

Comments
 (0)
0