From bbfa50869b15f460480a45a0938c7599af6dcee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Fri, 8 Dec 2023 11:29:44 +0100 Subject: [PATCH 1/3] refactor: hyper check --- Output/StreamOutput.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Output/StreamOutput.php b/Output/StreamOutput.php index 7f5551827..63a74411f 100644 --- a/Output/StreamOutput.php +++ b/Output/StreamOutput.php @@ -98,10 +98,6 @@ protected function hasColorSupport() return false; } - if ('Hyper' === getenv('TERM_PROGRAM')) { - return true; - } - if (\DIRECTORY_SEPARATOR === '\\') { return (\function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($this->stream)) @@ -110,6 +106,7 @@ protected function hasColorSupport() || 'xterm' === getenv('TERM'); } - return stream_isatty($this->stream); + return 'Hyper' === getenv('TERM_PROGRAM') + || stream_isatty($this->stream); } } From d9648a13dd575b6f781f93d9af05ee5ce3571fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Fri, 8 Dec 2023 11:23:42 +0100 Subject: [PATCH 2/3] fix xterm detection --- Output/StreamOutput.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Output/StreamOutput.php b/Output/StreamOutput.php index 63a74411f..f67fe5904 100644 --- a/Output/StreamOutput.php +++ b/Output/StreamOutput.php @@ -64,9 +64,6 @@ public function getStream() return $this->stream; } - /** - * {@inheritdoc} - */ protected function doWrite(string $message, bool $newline) { if ($newline) { @@ -103,7 +100,7 @@ protected function hasColorSupport() && @sapi_windows_vt100_support($this->stream)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') - || 'xterm' === getenv('TERM'); + || str_starts_with((string) getenv('TERM'), 'xterm'); } return 'Hyper' === getenv('TERM_PROGRAM') From 4b4d8cd118484aa604ec519062113dd87abde18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Fri, 8 Dec 2023 14:32:57 +0100 Subject: [PATCH 3/3] detect colors on not windows --- Output/StreamOutput.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Output/StreamOutput.php b/Output/StreamOutput.php index f67fe5904..f057f0e51 100644 --- a/Output/StreamOutput.php +++ b/Output/StreamOutput.php @@ -95,15 +95,17 @@ protected function hasColorSupport() return false; } - if (\DIRECTORY_SEPARATOR === '\\') { - return (\function_exists('sapi_windows_vt100_support') - && @sapi_windows_vt100_support($this->stream)) - || false !== getenv('ANSICON') - || 'ON' === getenv('ConEmuANSI') - || str_starts_with((string) getenv('TERM'), 'xterm'); + if (\DIRECTORY_SEPARATOR === '\\' + && \function_exists('sapi_windows_vt100_support') + && @sapi_windows_vt100_support($this->stream) + ) { + return true; } return 'Hyper' === getenv('TERM_PROGRAM') + || false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || str_starts_with((string) getenv('TERM'), 'xterm') || stream_isatty($this->stream); } } 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