Skip to content

Commit

Permalink
minor #52942 Refactor hyper check location (theofidry)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.4 branch.

Discussion
----------

Refactor hyper check location

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | None
| License       | MIT

Extracted from #52940 to reduce the noise of that PR. There is no logic change, only a potentially a performance (I assume non-existent given it's a if check of a constant). If it is a concern however, this could be checked _before_ the windows specific checks.

Commits
-------

9c09e16 refactor: hyper check
  • Loading branch information
fabpot committed Dec 8, 2023
2 parents 8d06a8a + 9c09e16 commit 4496b59
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Symfony/Component/Console/Output/StreamOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -110,6 +106,7 @@ protected function hasColorSupport()
|| 'xterm' === getenv('TERM');
}

return stream_isatty($this->stream);
return 'Hyper' === getenv('TERM_PROGRAM')
|| stream_isatty($this->stream);
}
}

0 comments on commit 4496b59

Please sign in to comment.