-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ANSI escape color codes broken on Git Bash in Windows Terminal #19391
Comments
@jiasli for awareness |
Azure CLI has been affected by colorama bugs for a long time (microsoft/knack#209). That's why we stopped initializing colorama in Linux terminals (microsoft/knack#238). If we check
This corrupts the color detection logic: if sys.stdout.isatty() and sys.stderr.isatty() and self.out_file is sys.stdout:
self.init_debug_log.append("Enable color in terminal.")
return True CLI thinks this is not a TTY and turns off the color, even though escape sequences are indeed supported.
Found these discussions:
However, in Git Bash running in Windows Terminal,
But escape sequences can't be displayed correctly:
Discussions on the topic:
So this is actually a "Git Bash in Windows Terminal" problem. For now, I would recommend these workarounds:
|
@jiasli Thanks for the detailed write-up. I suspected it was a simple regression, perhaps pulling in a new version of a 3rd party dependency that regressed, however, it's not unsurprising that the plot thickens this much with things like git-for-windows, and the WT 😅 The workaround is really helpful, I didn't knew about that. It really makes the output usable, and made my day ❤️ Thnx! |
I am glad to know the workaround works for you! Please free feel to contact us if there are any problems. 😊 |
Describe the bug
Running the az CLI on Windows using Git Bash in the Windows Terminal shows color output is broken. This is specific to this situation (see below for more context). When running
$ az help
, the output ends with:To Reproduce
$ az help
Expected behavior
Output is showing colors.
Environment summary
Additional context
I ran into this when setting up a new dev box, and also found out the following details:
2.15.1
UPDATE: Results of some additional testing
I wanted to be sure that the reproduction steps are sound on a new system, with pretty much all the defaults, and installing from MSI, or Windows Store (for the Windows Terminal). So I created a new VM in Azure with Windows 10 Pro 20H2, and managed to reproduce this in this fresh box.
I also did some additional research where this broke, so I did a "git bisect" but then via installing the MSIs, and there are my results:
Needless to say, version 2.22 broke this.
The text was updated successfully, but these errors were encountered: