8000 Windows 10 console seems to now provide ANSI support without ANSICON. · Issue #17499 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Windows 10 console seems to now provide ANSI support without ANSICON. #17499

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

Closed
rquadling opened this issue Jan 22, 2016 · 9 comments
Closed

Comments

@rquadling
Copy link
Contributor

\Symfony\Component\Console\Output\StreamOutput::hasColorSupport() will probably need updating as Windows 10 ConHost+CMD now seems to provide ANSI support without the need to use ANSICON.

Whilst doing that is/should be easy enough, I don't know how to get the terminal dimensions for \Symfony\Component\Console\Application::getTerminalDimensions.

@xabbuh xabbuh added the Console label Jan 22, 2016
@linaori
Copy link
Contributor
linaori commented Jan 23, 2016

Windows + gitbash for example isn't working as nice either (or powershell for that matter).

@foglcz
Copy link
foglcz commented May 16, 2016

Just noticed this thanks to composer, and it does not play nice at all. See below screenshot:

w10console

It seems as if the escape sequence is not interpreted, maybe there's a windows-flavored-ansi?
Like \r\n vs \n ? 😄

edit: Affected versions are windows 10 preview builds. AFAIK this is not in retail yet.

edit 2: More detailed reading here -> http://www.nivot.org/blog/post/2016/02/04/Windows-10-TH2-%28v1511%29-Console-Host-Enhancements

@Seldaek
Copy link
Member
Seldaek commented May 16, 2016

This has been fixed in #18385 but the fix doesn't really seem to work as per composer/composer#5323

@rquadling
Copy link
Contributor Author

I am running Insider Preview, so sorry for jumping the gun on this one.

@cirdog
Copy link
cirdog commented Aug 26, 2016

If this hasn't been mentioned before, the global workaround for Windows is:

C:\ProgramData\ComposerSetup\bin\composer.bat
(edit its content)
php "%~dp0composer.phar" %* --no-ansi

Adding the "--no-ansi" flag at the launch script of composer eliminates the need to flag it for every command.

@mlocati
Copy link
Contributor
mlocati commented Aug 30, 2016

I'm posting here since it's the only open issue regarding color support on Windows.

A short history:

I've managed to find some time to suggest the PHP core team a new function to enable ANSI colors under Windows: see php/php-src#2103.
It's still under discussion, but the final implementation should be quite near.

When everything will be ready, I'll create a new PR to add color support for Symfony under newer builds of Windows.

@fabpot
Copy link
Member
fabpot commented Feb 21, 2018

Closing as this is fixed now.

@fabpot fabpot closed this as completed Feb 21, 2018
@kelunik
Copy link
Contributor
kelunik commented Mar 17, 2018

Seems like the implementation is incomplete.

|| '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD

That makes an equality check, but I guess it's supposed to be version_compare?

@mlocati
Copy link
Contributor
mlocati commented Mar 20, 2018

That makes an equality check, but I guess it's supposed to be version_compare?

@kelunik Nope.
Microsoft added support to colored terminals in Windows 10.0.10586.
This feature was initially enabled by default; BTW, next Windows versions disabled it, and PHP have to enable it explicitly.
For PHP versions <7.2, we don't have control of that feature.

Starting from PHP 7.2, PHP enables this feature on startup, and we have the sapi_windows_vt100_support function to check if it's enabled.

shobhit99 added a commit to shobhit99/XSStrike that referenced this issue Feb 3, 2019
Windows 10 added support for ANSI colors since Build 10586.
From Build 14393 ANSI needs to enabled by executable, hence os.system('') is used

Source : 
https://stackoverflow.com/a/39675059
symfony/symfony#17499
fgm0129f added a commit to fgm0129f/Ra1dhunter that referenced this issue Jan 7, 2022
Windows 10 added support for ANSI colors since Build 10586.
From Build 14393 ANSI needs to enabled by executable, hence os.system('') is used

Source : 
https://stackoverflow.com/a/39675059
symfony/symfony#17499
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

10 participants
0