New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Console] Fix color support check on non-Windows platforms #52940
Conversation
Hey! To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done? Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review. Cheers! Carsonbot |
The referenced issue mentioned 5.4, should this PR target 5.4 too? |
Ah indeed, my bad I forgot 5.4 is still supported. |
Yo @carsonbot not cool |
thanks @xabbuh ❤️ |
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
d82e498
to
285518d
Compare
Thank you @theofidry. |
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [symfony/console](https://symfony.com) ([source](https://togithub.com/symfony/console)) | `6.4.1` -> `6.4.2` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/process](https://symfony.com) ([source](https://togithub.com/symfony/process)) | `6.4.0` -> `6.4.2` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>symfony/console (symfony/console)</summary> ### [`v6.4.2`](https://togithub.com/symfony/console/releases/tag/v6.4.2) [Compare Source](https://togithub.com/symfony/console/compare/v6.4.1...v6.4.2) **Changelog** (symfony/console@v6.4.1...v6.4.2) - bug [symfony/symfony#52940](https://togithub.com/symfony/symfony/issues/52940) \[Console] Fix color support check on non-Windows platforms ([@​theofidry](https://togithub.com/theofidry)) - bug [symfony/symfony#52941](https://togithub.com/symfony/symfony/issues/52941) \[Console] Fix xterm detection ([@​theofidry](https://togithub.com/theofidry)) </details> <details> <summary>symfony/process (symfony/process)</summary> ### [`v6.4.2`](https://togithub.com/symfony/process/releases/tag/v6.4.2) [Compare Source](https://togithub.com/symfony/process/compare/v6.4.0...v6.4.2) **Changelog** (symfony/process@v6.4.1...v6.4.2) - bug [symfony/symfony#52864](https://togithub.com/symfony/symfony/issues/52864) \[HttpClient]\[Mailer]\[Process] always pass microseconds to usleep as integers ([@​xabbuh](https://togithub.com/xabbuh)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Lendable/composer-license-checker). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMDMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjEwMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
… if the output (theofidry) This PR was merged into the 5.4 branch. Discussion ---------- [Console] Only execute additional checks for color support if the output is a TTY | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #53460 | License | MIT As reported in #53460, the modifications done in #52940 are incorrect as it results in detecting that the stream can support colors despite not being a TTY. Rather than doing a simple revert which would re-introduce the pre-existing issue that #52940 attempted to fix, this PR checks if the output is a TTY based on Composer's code and does this check before anything else. Indeed a TTY only means that colors _may_ be supported, so the various checks that we were doing do make sense to be done but should be done after this TTY (so `Hyper` is not an exception, it can be a TTY or not). Commits ------- 2e96b22 [Console] Only execute additional checks for color support if the output is a TTY
Currently checking the color support based on
ANSICON
,ConEmuANSI=ON
orTERM=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 thatTERM=xTerm
is a term check and we do another one (not Widows specific) which isTERM_PROGRAM=Hyper
.This potentially fixes #45917.
This also looks more in line with the intent (based on the title) of #27831 and #27794.