Skip to content

Commit 57f60d0

Browse files
committed
bug #52941 [Console] Fix xterm detection (theofidry)
This PR was merged into the 5.4 branch. Discussion ---------- [Console] Fix xterm detection | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | None reported | License | MIT Currently `StreamOutput::hasColorSupport()` returns `true` if `TERM=xterm`. However xterm may have different values such as `xterm-256color`. Technically I think it would be more correct to check `xterm` or starts with `xterm-`, but I am not convinced there is a need to do so and one may prefer the (tiny) performance advantage? This can easily be changed though. Commits ------- 109c088 fix xterm detection
2 parents 4496b59 + 109c088 commit 57f60d0

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ public function getStream()
6464
return $this->stream;
6565
}
6666

67-
/**
68-
* {@inheritdoc}
69-
*/
7067
protected function doWrite(string $message, bool $newline)
7168
{
7269
if ($newline) {
@@ -103,7 +100,7 @@ protected function hasColorSupport()
103100
&& @sapi_windows_vt100_support($this->stream))
104101
|| false !== getenv('ANSICON')
105102
|| 'ON' === getenv('ConEmuANSI')
106-
|| 'xterm' === getenv('TERM');
103+
|| str_starts_with((string) getenv('TERM'), 'xterm');
107104
}
108105

109106
return 'Hyper' === getenv('TERM_PROGRAM')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy