Git-bash ansi/vt100 #6743

Closed
opened 2026-01-31 00:46:13 +00:00 by claunia · 11 comments
Owner

Originally created by @molszews on GitHub (Mar 5, 2020).

Environment

Windows build number: Microsoft Windows NT 10.0.19041.0
Windows Terminal version: 0.9.433.0

Any other software?
Git for windows: 2.25.1 (picked cmd.exe instead of MinTTY as the terminal emulator for git-bash)
Git bash/uname: MINGW64_NT-10.0-19041 SPNTECHLAP16 3.0.7-338.x86_64 2019-11-21 23:07 UTC x86_64 Msys

Steps to reproduce

  1. Run git-bash through Windows Terminal
  2. Execute tool that produces ansi sequences, e.g. stern

Expected behavior

  1. Ansi/vt100 sequences are processed

Actual behavior

  1. Ansi/vt100 sequences are visible in terminal output

Comments

There are similar issues already here tracked, however, I'm not 100% sure if this is the same case (cygwin related issue #2837), as starting git-bash and running apps there works fine:
just git-bash

Problem is when the same git-bash is now started via Windows Terminal,
git-bash+win term

Originally created by @molszews on GitHub (Mar 5, 2020). # Environment ```none Windows build number: Microsoft Windows NT 10.0.19041.0 Windows Terminal version: 0.9.433.0 Any other software? Git for windows: 2.25.1 (picked cmd.exe instead of MinTTY as the terminal emulator for git-bash) Git bash/uname: MINGW64_NT-10.0-19041 SPNTECHLAP16 3.0.7-338.x86_64 2019-11-21 23:07 UTC x86_64 Msys ``` # Steps to reproduce 1. Run git-bash through Windows Terminal 1. Execute tool that produces ansi sequences, e.g. `stern` # Expected behavior 1. Ansi/vt100 sequences are processed # Actual behavior 1. Ansi/vt100 sequences are visible in terminal output # Comments There are similar issues already here tracked, however, I'm not 100% sure if this is the same case (cygwin related issue #2837), as starting git-bash and running apps there works fine: ![just git-bash](https://i.imgur.com/XqFp9f2.png) Problem is when the same git-bash is now started via Windows Terminal, ![git-bash+win term](https://i.imgur.com/XVvlwYo.png)
claunia added the Resolution-Duplicate label 2026-01-31 00:46:13 +00:00
Author
Owner

@jdebp commented on GitHub (Mar 5, 2020):

Compare #3767 and #4788.

@jdebp commented on GitHub (Mar 5, 2020): Compare #3767 and #4788.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 5, 2020):

I'm fairly sure this is the same root cause as https://github.com/microsoft/terminal/issues/2837#issuecomment-533830745 (the cygwin/msys2 runtime (which are pretty much the same code) isn't acting the same as it would in standard conhost, even though WT goes to great lengths to ensure that conhost things work as well as possible.)

Would you mind sharing the output of echo $TERM inside and outside WT, but in git-bash?

Additionally, would you mind sharing your git-bash profile snippet (from profiles.json)?

@DHowett-MSFT commented on GitHub (Mar 5, 2020): I'm fairly sure this is the same root cause as https://github.com/microsoft/terminal/issues/2837#issuecomment-533830745 (the cygwin/msys2 runtime (which are pretty much the same code) isn't acting the same as it would in standard conhost, even though WT goes to great lengths to ensure that conhost things work as well as possible.) Would you mind sharing the output of `echo $TERM` inside and outside WT, but in git-bash? Additionally, would you mind sharing your git-bash profile snippet (from profiles.json)?
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 5, 2020):

(Tentative dupe ruling stands until more info comes in; closing)

@DHowett-MSFT commented on GitHub (Mar 5, 2020): (Tentative dupe ruling stands until more info comes in; closing)
Author
Owner

@molszews commented on GitHub (Mar 6, 2020):

both inside and outside WT, but in git-bash, echo $TERM results with cygwin
snippet from profiles.json:

{
            "guid": "{00000000-0000-0000-0000-000000000002}",
            "acrylicOpacity": 0.85,
            "closeOnExit": true,
            "colorScheme": "Solarized Dark",
            "commandline": "\"%PROGRAMFILES%\\git\\git-cmd.exe\" --no-cd --command=bin/bash.exe --login -i -l",
            "cursorColor": "#FFFFFF",
            "cursorShape": "bar",
            "fontFace": "Consolas",
            "fontSize": 14,
            "historySize": 9001,
            "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
            "name": "git-bash",
            "snapOnInput": true,
            "startingDirectory": "c:\\git",
            "useAcrylic": true
        }
@molszews commented on GitHub (Mar 6, 2020): both inside and outside WT, but in git-bash, `echo $TERM` results with `cygwin` snippet from profiles.json: ``` { "guid": "{00000000-0000-0000-0000-000000000002}", "acrylicOpacity": 0.85, "closeOnExit": true, "colorScheme": "Solarized Dark", "commandline": "\"%PROGRAMFILES%\\git\\git-cmd.exe\" --no-cd --command=bin/bash.exe --login -i -l", "cursorColor": "#FFFFFF", "cursorShape": "bar", "fontFace": "Consolas", "fontSize": 14, "historySize": 9001, "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png", "name": "git-bash", "snapOnInput": true, "startingDirectory": "c:\\git", "useAcrylic": true } ```
Author
Owner

@molszews commented on GitHub (Mar 8, 2020):

@DHowett-MSFT I've just managed to fix the problem by recompiling Git for windows using Cygwin 3.1.2 and essentially replacing the msys-2.0.dll (it is essentially the cygwin1.dll) binary - it works perfectly now!

@molszews commented on GitHub (Mar 8, 2020): @DHowett-MSFT I've just managed to fix the problem by recompiling Git for windows using Cygwin 3.1.2 and essentially replacing the msys-2.0.dll (it is essentially the cygwin1.dll) binary - it works perfectly now!
Author
Owner

@dahlbyk commented on GitHub (Mar 14, 2020):

FWIW this was reported for git gui (https://github.com/dahlbyk/posh-git/issues/738), and I can reproduce in conhost.

@dahlbyk commented on GitHub (Mar 14, 2020): FWIW this was reported for `git gui` (https://github.com/dahlbyk/posh-git/issues/738), and I can reproduce in conhost.
Author
Owner

@patrikhuber commented on GitHub (Mar 14, 2020):

Hi @DHowett-MSFT,

According to the git-gui developer, @prati0100, this is a Windows Terminal issue, and not a git-gui issue.

I don't think my issue is related to https://github.com/microsoft/terminal/issues/2837#issuecomment-533830745, as I am using PowerShell 6 and not cygwin/msys2.

I am also not sure whether my issue is related to this issue which seems to be about git-bash, and I am using pwsh.

@DHowett-MSFT can you re-open this issue, or am I having a different bug and should I open a new issue?
As my issue seems neither a posh-git nor a git-gui issue and I am using PowerShell 6, the https://github.com/microsoft/terminal/ repository seems the right place for the bug I am encountering.

Thanks a lot.

@patrikhuber commented on GitHub (Mar 14, 2020): Hi @DHowett-MSFT, According to the git-gui developer, @prati0100, this is a Windows Terminal issue, and not a git-gui issue. I don't think my issue is related to https://github.com/microsoft/terminal/issues/2837#issuecomment-533830745, as I am using **PowerShell 6** and not cygwin/msys2. I am also not sure whether my issue is related to this issue which seems to be about git-bash, and I am using pwsh. @DHowett-MSFT can you re-open this issue, or am I having a different bug and should I open a new issue? As my issue seems neither a posh-git nor a git-gui issue and I am using PowerShell 6, the https://github.com/microsoft/terminal/ repository seems the right place for the bug I am encountering. Thanks a lot.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 14, 2020):

Hey @patrikhuber! What you’re seeing is definitely different from this issue; mind filing a separate one?

I’ve seen some unusual behavior with git-gui where launching it (a graphical application) resets the output handle to not process VT until the shell steps in and fixes it, but I haven’t grabbed console host traces to see what exactly is happening.

@DHowett-MSFT commented on GitHub (Mar 14, 2020): Hey @patrikhuber! What you’re seeing is definitely different from this issue; mind filing a separate one? I’ve seen some unusual behavior with git-gui where launching it (a graphical application) resets the output handle to not process VT until the shell steps in and fixes it, but I haven’t grabbed console host traces to see what exactly is happening.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 14, 2020):

(Incidentally: when I say it’s a Cygwin issue, it may still apply to git-gui even if you’re not knowingly using Cygwin. The runtime that it uses for being POSIXy cross-platform is derived from (or in some cases directly built from) Cygwin’s standard library 😄)

@DHowett-MSFT commented on GitHub (Mar 14, 2020): (Incidentally: when I say it’s a Cygwin issue, it may still apply to git-gui even if you’re not knowingly using Cygwin. The runtime that it uses for being POSIXy cross-platform is _derived_ from (or in some cases directly built from) Cygwin’s standard library :smile:)
Author
Owner

@patrikhuber commented on GitHub (Mar 14, 2020):

@DHowett-MSFT Sure! I've opened #4921.

Thanks a lot for the quick reply!

(Ah I think I see what you mean. Git-gui probably uses Cygwin/msys2, so this might be related even though I am using PowerShell and not git-bash.)

@patrikhuber commented on GitHub (Mar 14, 2020): @DHowett-MSFT Sure! I've opened #4921. Thanks a lot for the quick reply! (Ah I think I see what you mean. Git-gui probably uses Cygwin/msys2, so this might be related even though I am using PowerShell and not git-bash.)
Author
Owner

@trajano commented on GitHub (Jun 21, 2020):

@molszews can you create a PR for https://github.com/git-for-windows/git that upgrades the libraries? Maybe that would get the ball rolling?

@trajano commented on GitHub (Jun 21, 2020): @molszews can you create a PR for https://github.com/git-for-windows/git that upgrades the libraries? Maybe that would get the ball rolling?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6743