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 d82e498

Browse filesBrowse files
committed
fix: Correctly check color support
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.
1 parent a314b65 commit d82e498
Copy full SHA for d82e498

File tree

1 file changed

+9
-10
lines changed
Filter options

1 file changed

+9
-10
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Output/StreamOutput.php
+9-10Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,17 @@ protected function hasColorSupport(): bool
9797
return false;
9898
}
9999

100-
if ('Hyper' === getenv('TERM_PROGRAM')) {
100+
if (\DIRECTORY_SEPARATOR === '\\'
101+
&& \function_exists('sapi_windows_vt100_support'
102+
&& @sapi_windows_vt100_support($this->stream)
103+
) {
101104
return true;
102105
}
103106

104-
if (\DIRECTORY_SEPARATOR === '\\') {
105-
return (\function_exists('sapi_windows_vt100_support')
106-
&& @sapi_windows_vt100_support($this->stream))
107-
|| false !== getenv('ANSICON')
108-
|| 'ON' === getenv('ConEmuANSI')
109-
|| 'xterm' === getenv('TERM');
110-
}
111-
112-
return stream_isatty($this->stream);
107+
return 'Hyper' === getenv('TERM_PROGRAM')
108+
|| false !== getenv('ANSICON')
109+
|| 'ON' === getenv('ConEmuANSI')
110+
|| 'xterm' === getenv('TERM')
111+
|| stream_isatty($this->stream);
113112
}
114113
}

0 commit comments

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