-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added some notes about Windows and colours. #2062
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
Conversation
@@ -20,6 +20,12 @@ You can install the component in many different ways: | |||
* Use the official Git repository (https://github.com/symfony/Console); | |||
* :doc:`Install it via Composer</components/using_components>` (``symfony/console`` on `Packagist`_). | |||
|
|||
..note:: | |||
|
|||
Windows does not support ANSI colours by default so you will experience problems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, there is no "problems" when the console does not support colors. Colors are just disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the wording can be better, but they are disabled because Windows will not display ANSI colours unless Windows has an ANSI driver installed. It's not a problem for Console as it detects this, but anything you might invoke that does emit ANSI sequences is going to cause ANSI characters to be displayed. I think there needs to be some reference to this somewhere because it's a very common problem.
Reworded it taking comments into consideration. |
|
||
Windows does not support ANSI colours by default so the Console Component detects and | ||
disables colours where windows does not have support. However, if your console commands | ||
invoke other scripts which emit ANSI colour sequences, they will be shown as raw escape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they "might" be show.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ANSICON is not installed, they will be shown for sure. E.g. if you have phpunit.xml.dist set to emit colours from the console, you will get raw ANSI sequences under Windows from a Console command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPUnit has nothing to do with the Console component. It does not use it
Reworded again taking into account feedback. |
|
||
Windows does not support ANSI colors by default so the Console Component detects and | ||
disables colors where Windows does not have support. However, if your console command | ||
invokes other scripts which emit ANSI color sequences, they will be shown as raw escape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, should be "might". The Symfony console always behaves correctly. PHPUnit does, but we don't care about that; I mean, someone should probably report that to PHPUnit, but it has nothing to do with Symfony. I would even say that this sentence should be removed altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an attempt to cover all bases. If your console commands running other php scripts that use emit colours and Windows is not setup for ANSI, you will get ugly ANSI escape characters displayed with 100% certainty. I use Windows as my development environment so I'm very familiar with this phenomenon:. There is no might, it's 100% sure you will get ugly characters displayed. The point of this note is make it clear that while the Console command has control over what it emits and can detect whether colours are available, it has no control over vendor PHP scripts you might run in the console and makes it crystal clear that Windows must be configured to use ANSI.
Without ANSICON, if you force --ansi for the Console, it will also display garbage ANSI escape sequences. It's up to you - this is about clearly documenting a phenomenon so you can refer to it when you inevitably get github issues being opened by those who do not know about the problem.
about firewall, firewall map, firewall listeners, authentication manager, password encoder factory, password encoders, user providers
Refs: symfony/symfony#6478
The motivation here is to stop repeated issues being reported to the Console tracker for this issue and provide a documented solution to the display of colours under Windows.