Skip to content
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

CLI colors are broken in Docker #45917

Closed
mvorisek opened this issue Apr 2, 2022 · 4 comments
Closed

CLI colors are broken in Docker #45917

mvorisek opened this issue Apr 2, 2022 · 4 comments

Comments

@mvorisek
Copy link
Contributor

mvorisek commented Apr 2, 2022

Symfony version(s) affected

5.4.5

Description

see composer/composer#10691 (comment) /w repro DockerFile

Possible Solution

colors supported correctly

@mathela59
Copy link

In fact, colrization inside a docker depends of the shell used in docker. I'm not sure that the problem is a Symfony problem.

Moreover, if your docker is run under root user, it's normal that colorization is disabled.

In my opinion this is not an issue.

Maybe you should try ls --color to see if your shell support it .

@mvorisek
Copy link
Contributor Author

Code to repro:

Dockerfile: https://github.com/mvorisek/image-php/blob/master/data/8.1-debian/Dockerfile#L57
CI: https://github.com/mvorisek/image-php/runs/5796737502?check_suite_focus=true#step:6:103

there is some transformation, but what supprises me is the coloring is more or less random

@fabpot
Copy link
Member

fabpot commented Aug 3, 2022

Feel free to submit a PR if you think there is something we can improve here.

@fabpot
Copy link
Member

fabpot commented Dec 8, 2023

Fixed by #52940

fabpot added a commit that referenced this issue Dec 8, 2023
… (theofidry)

This PR was merged into the 5.4 branch.

Discussion
----------

[Console] Fix color support check on non-Windows platforms

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #45917
| License       | MIT

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.

Commits
-------

285518d detect colors on not windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants