Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7121397

Browse filesBrowse files
committed
bug #52940 [Console] Fix color support check on non-Windows platforms (theofidry)
This PR was merged into the 5.4 branch. Discussion ---------- [Console] Fix color support check on non-Windows platforms | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #45917 | License | MIT Currently checking the color support based on `ANSICON`, `ConEmuANSI=ON` or `TERM=xTerm` is done only for Widows. I could not find any reason as to why and it does not make much sense as it is. Especially if we consider that `TERM=xTerm` is a term check and we do another one (not Widows specific) which is `TERM_PROGRAM=Hyper`. This potentially fixes #45917. This also looks more in line with the intent (based on the title) of #27831 and #27794. Commits ------- 285518d detect colors on not windows
2 parents 8c56020 + 285518d commit 7121397
Copy full SHA for 7121397

File tree

1 file changed

+8
-6
lines changed
Filter options

1 file changed

+8
-6
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Output/StreamOutput.php
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,17 @@ protected function hasColorSupport()
9595
return false;
9696
}
9797

98-
if (\DIRECTORY_SEPARATOR === '\\') {
99-
return (\function_exists('sapi_windows_vt100_support')
100-
&& @sapi_windows_vt100_support($this->stream))
101-
|| false !== getenv('ANSICON')
102-
|| 'ON' === getenv('ConEmuANSI')
103-
|| str_starts_with((string) getenv('TERM'), 'xterm');
98+
if (\DIRECTORY_SEPARATOR === '\\'
99+
&& \function_exists('sapi_windows_vt100_support')
100+
&& @sapi_windows_vt100_support($this->stream)
101+
) {
102+
return true;
104103
}
105104

106105
return 'Hyper' === getenv('TERM_PROGRAM')
106+
|| false !== getenv('ANSICON')
107+
|| 'ON' === getenv('ConEmuANSI')
108+
|| str_starts_with((string) getenv('TERM'), 'xterm')
107109
|| stream_isatty($this->stream);
108110
}
109111
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.