-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Bug Report: ANSI Color Sequences not having effect when running through cygwin bash #2837
Comments
I have confirmed that the issue is between Windows Terminal and |
Is there a chance that Cygwin knows it’s connected to a “console” and has implemented its own SGR parser? We have seen this with other runtimes before. |
Nope. |
Yeah, that seems to be the case. |
That seems consistent with my testing, though I can't confirm for sure this is what is occuring without taking a look at the source for |
Yep, everything is running through conhost. |
I'm looking at the code for cygwin now, but it seems that the easiest fix would be to allow the profile the ability to set the console front-end program (though I'm not sure how feasible this is), as the other fixes on the Terminal end of things would likely involve either implementing mintty within the Terminal, or making invasive calls to cygwin within the shell program's process space itself. |
I think the best long-term fix is to teach Cygwin that on Windows 10 (they’ve had some time to come to terms with this 😄) they can delegate all VT rendering and almost all VT input synthesis to the windows console host. That’s what WSL does, and because of that we’re striving for pretty solid compatibility. Right now, Terminal expects to have conhost in the way “translating” for it, because conhost has good VT support and Terminal’s isn’t quite hooked up. There’s a lot of reasons for that, the most salient of which is that it was faster to make WT a Conhost host than to do anything else. In the long term we need to fix that for connectors like Azure and SSH, but in the near term it suffices for well-behaved clients. |
We’ve had this trouble before. Ever since we added 24-bit color support we’ve been running into applications that thought they were clever and that we would never add support for anything that was invented after 1980! |
I'm going to close this as External and perhaps file a followup over on Cygwin. |
as per msys2/MSYS2-packages#1684 (comment) this has been fixed with cygwin 3.1 |
@DHowett-MSFT seems that they fixed git for windows to have the newer packages and it fixed the ANSI sequences for Bash itself. But does not appear to do so for the processes called by bash. I'm just scanning through the bug reports to see if there was one I can attach the details I found git-for-windows/git#2483 (comment) |
Environment
Steps to reproduce
Using cygwin bash,
Execute the following shell command:
printf "\033[38;2;255;0;0mHi\033[0m"
.Similar behavior is achieved from the C function
printf
in a standalone application, when compiled using a cygwin compiler, and linking the C functionprintf
with the one defined by cygwin1.dll.Other shells running in cygwin have not been tested, and lack of known functionality in cmd.exe and Powershell have made testing the shell command directly difficult. Tests of the C function, when compiled using Microsoft Visual Studio, have proved positive on all tested shells.
Expected behavior
Execution of the shell command on both native linux bash and cygwin bash when run through mintty.exe (cygwin tty host executable) prints Hi in bright red, the expected behavior.
Actual behavior
The "Hi" is printed correctly and the escape sequences are not printed in any form, however the color is not applied.
Additional Notes
I do not believe this is a bash issue, as it works correctly in both mintty provided by cygwin and in the bash shell run in a native linux environment. The likely cause is some disparity in the handling of ANSI Escape Sequences between cygwin glibc (provided by
cygwin1.dll
) and Windows Terminal. I will make further attempts to confirm this issue in cmd.exe and powershell using binaries linked againstcygwin1.dll
rather than Microsoft CRT.The text was updated successfully, but these errors were encountered: