ANSI escape codes in output using git for windows #17476

Closed
opened 2026-01-31 05:43:37 +00:00 by claunia · 5 comments
Owner

Originally created by @jcrben on GitHub (May 14, 2022).

NOTE: I've seen some reports which suggest that this would be fixed by later Windows versions, so I'm on the Windows Insider preview... I've seen this with another application (https://github.com/go-task/task); I've also used ansicon to get around it but that cuts out some of the scrollback

Windows Terminal version

1.12.10983.0

Windows build number

10.0.22621.0

Other Software

No response

Steps to reproduce

Download https://search.maven.org/search?q=a:junit-platform-console-standalone by clicking the Download link
image

Install java: winget install Microsoft.OpenJDK.11
Install Git for Windows interactively: winget install Git.Git -i

When installing Git for Windows, enable the option to add it to the Microsoft Terminal

Open a Git Bash tab:

Execute the following:
`cd ~/Downloads; 'C:\Program Files\Microsoft\jdk-11.0.15.10-hotspot\bin\java.exe' -jar ./junit-platform-console-standalone-1.8.2.jar;

The output contains ANSI escape codes:
image

Expected Behavior

Colored output (or bolded, underlined - not sure what the codes map over to)

Actual Behavior

ANSI escape codes

Originally created by @jcrben on GitHub (May 14, 2022). NOTE: I've seen some reports which suggest that this would be fixed by later Windows versions, so I'm on the Windows Insider preview... I've seen this with another application (https://github.com/go-task/task); I've also used ansicon to get around it but that cuts out some of the scrollback ### Windows Terminal version 1.12.10983.0 ### Windows build number 10.0.22621.0 ### Other Software _No response_ ### Steps to reproduce Download https://search.maven.org/search?q=a:junit-platform-console-standalone by clicking the Download link ![image](https://user-images.githubusercontent.com/5614134/168408615-55ddcd5d-b422-4eb3-a11a-f4e3489b04d9.png) Install java: `winget install Microsoft.OpenJDK.11` Install Git for Windows interactively: `winget install Git.Git -i` When installing Git for Windows, enable the option to add it to the Microsoft Terminal Open a Git Bash tab: Execute the following: `cd ~/Downloads; 'C:\Program Files\Microsoft\jdk-11.0.15.10-hotspot\bin\java.exe' -jar ./junit-platform-console-standalone-1.8.2.jar; The output contains ANSI escape codes: ![image](https://user-images.githubusercontent.com/5614134/168409124-65f06f2a-8d74-46b1-98db-2623b7615fea.png) ### Expected Behavior Colored output (or bolded, underlined - not sure what the codes map over to) ### Actual Behavior ANSI escape codes
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 05:43:37 +00:00
Author
Owner

@ianjoneill commented on GitHub (May 14, 2022):

I believe this is the same issue as #6634 - see over there for more information.

@ianjoneill commented on GitHub (May 14, 2022): I believe this is the same issue as #6634 - see over there for more information.
Author
Owner

@zadjii-msft commented on GitHub (May 16, 2022):

This does look like the same thing as /dup #6634 to me. See https://github.com/microsoft/terminal/issues/6634#issuecomment-647726408 specifically.

@zadjii-msft commented on GitHub (May 16, 2022): This does look like the same thing as /dup #6634 to me. See https://github.com/microsoft/terminal/issues/6634#issuecomment-647726408 specifically.
Author
Owner

@ghost commented on GitHub (May 16, 2022):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (May 16, 2022): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@jcrben commented on GitHub (May 16, 2022):

That closed issue doesn't really explain things very well for the average user who isn't intimately familiar with the architecture of terminals, consoles, and shells. Is there a TL;DR as to why you can't just fix this by tracking and making PRs against these upstream clients? Why not keep things like this open and track these legacy applications, especially when it's something as huge as java? This team is going to be the most motivated to add flags which specifically target your Windows architecture. Otherwise this issue probably just remain for the next decade or so and you'll keep getting duplicate issue reports.

Note that just using the terminal which ships with Git for Windows, ANSI escape codes are displayed properly.

I'm willing to make a PR against the jdk I suppose but it's going to take me far longer and I'd be flying pretty blind in doing so.

@jcrben commented on GitHub (May 16, 2022): That closed issue doesn't really explain things very well for the average user who isn't intimately familiar with the architecture of terminals, consoles, and shells. Is there a TL;DR as to why you can't just fix this by tracking and making PRs against these upstream clients? Why not keep things like this open and track these legacy applications, especially when it's something as huge as java? This team is going to be the most motivated to add flags which specifically target your Windows architecture. Otherwise this issue probably just remain for the next decade or so and you'll keep getting duplicate issue reports. Note that just using the terminal which ships with Git for Windows, ANSI escape codes are displayed properly. I'm willing to make a PR against the jdk I suppose but it's going to take me far longer and I'd be flying pretty blind in doing so.
Author
Owner

@jcrben commented on GitHub (May 16, 2022):

Also it's just a bit unclear to me - sounds like this is kind of a hack to allow legacy applications which do a bad thing to still work at the cost of not supporting these escape codes, but just want to make sure - it doesn't impose an ongoing requirement that terminal apps for *nix add special hacks just for Microsoft Terminal, does it? That seems like a battle that would never end @DHowett

Also maybe allow an option for users to break legacy applications and rip the band-aid off?

@jcrben commented on GitHub (May 16, 2022): Also it's just a bit unclear to me - sounds like this is kind of a hack to allow legacy applications which do a bad thing to still work at the cost of not supporting these escape codes, but just want to make sure - it doesn't impose an ongoing requirement that terminal apps for *nix add special hacks just for Microsoft Terminal, does it? That seems like a battle that would never end @DHowett Also maybe allow an option for users to break legacy applications and rip the band-aid off?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17476