You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Area-VTVirtual Terminal sequence supportIssue-DocsIt's a documentation issue that really should be on MicrosoftDocs/Console-DocsPriority-3A description (P3)Product-MetaThe product is the management of the products.
Which version of npm are you using? And where is it installed? And which version of git bash / mingw?
This looks like this isn't npm.exe, that would actually use SetConsoleMode to enable VT processing. Looks like it's just relying on that already being enabled.
I'm using npm v7.5.3 installed in C:\Program Files\nodejs\npm. The examples above are Windows Terminal/PowerShell, mintty/GNU bash, version 4.4.23(1)-release (x86_64-pc-msys), and Cmder/Cygwin GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) respectively. The Windows Terminal acts the same with my Cygwin Bash though.
ghost added
Needs-AttentionThe core contributors need to come back around and look at this ASAP.
I'm having a similar issue, but mine doesn't involve npm.
I use this script to fetch latest code. It depends on posh-git:
functionlt {
$rebase=Test-Path .git\rebase-merge
if ($rebase) {
Write-Prompt'Continuing rebase...'-ForegroundColor ([System.ConsoleColor]::DarkGray)
git rebase --continue
}
else {
$dirty=$(git status --porcelain)
if ($dirty) {
Write-Prompt'Stashing uncommitted changes...'-ForegroundColor ([System.ConsoleColor]::DarkGray)
git stash -u
}
Write-Prompt'Getting latest code...'-ForegroundColor ([System.ConsoleColor]::DarkGray)
$branch= git rev-parse --abbrev-ref HEAD
if ($branch-ne"master") {
git fetch origin master:master
}
git pull --rebase
if ($dirty) {
Write-Prompt'Reapplying uncommitted changes...'-ForegroundColor ([System.ConsoleColor]::DarkGray)
git stash pop
}
}
if ($?) {
if (Test-Path .git\rebase-merge) {
Write-Prompt'Merge conflict needs to be resolved.'-ForegroundColor ([System.ConsoleColor]::Blue)
} else {
Write-Prompt'Pull succeeded.'-ForegroundColor ([System.ConsoleColor]::Green)
}
} else {
Write-Prompt'Something went wrong.'-ForegroundColor ([System.ConsoleColor]::Red)
}
}
When I run it the first time, it displays the color escape codes incorrectly (that long wonky-looking bit at the end is my prompt): [Contents of git pull redacted]
When I run it a second time (when there's nothing to pull), it displays the colors correctly:
I'm using Windows Terminal 1.5.10411.0, PowerShell 7.1.2, posh-git v1.0.0-beta5, and git 2.30.1.windows.1. My font is JetBrains Mono.
I see above that Dustin was supposed to write one, but I can't find it.
Huh. I should write this stuff down!
So, the reason it would apply in one shell and not the other is that they take different approaches to enabling/disabling the VT_PROCESSING mode for client applications.
I believe PowerShell explicitly turns VT off when it spawns a client and turns it back on before displaying the prompt, whereas CMD restores the original console mode when it spawns a client and turns it back on before displaying the prompt.
In this case, the difference between "turning VT off" and "restoring the original mode" becomes critically important: in Terminal, the original mode that CMD restores already has VT turned on, so when msys2 comes to save/restore the mode on its own, VT is already on.
Area-VTVirtual Terminal sequence supportIssue-DocsIt's a documentation issue that really should be on MicrosoftDocs/Console-DocsPriority-3A description (P3)Product-MetaThe product is the management of the products.
Activity
[-]Code Escape Codes displayed incorrectly[/-][+]Color Escape Codes displayed incorrectly[/+]zadjii-msft commentedon Mar 1, 2021
Which version of
npmare you using? And where is it installed? And which version of git bash / mingw?This looks like this isn't
npm.exe, that would actually useSetConsoleModeto enable VT processing. Looks like it's just relying on that already being enabled.derekgreer commentedon Mar 1, 2021
I'm using npm v7.5.3 installed in C:\Program Files\nodejs\npm. The examples above are Windows Terminal/PowerShell, mintty/GNU bash, version 4.4.23(1)-release (x86_64-pc-msys), and Cmder/Cygwin GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) respectively. The Windows Terminal acts the same with my Cygwin Bash though.
TylerEich commentedon Mar 3, 2021
I'm having a similar issue, but mine doesn't involve npm.
I use this script to fetch latest code. It depends on posh-git:
When I run it the first time, it displays the color escape codes incorrectly (that long wonky-looking bit at the end is my prompt):


[Contents of git pull redacted]When I run it a second time (when there's nothing to pull), it displays the colors correctly:

I'm using Windows Terminal 1.5.10411.0, PowerShell 7.1.2, posh-git v1.0.0-beta5, and git 2.30.1.windows.1. My font is JetBrains Mono.
flupec commentedon Mar 25, 2021
Suffer from this issue too on Cygwin + Windows Terminal
zadjii-msft commentedon Mar 26, 2021
(I'm assigning Dustin because he's got an idea for an FAQ for the docs for this kind of issue)
mikofski commentedon May 29, 2021
I am also seeing this when using Django manage command in a Git-Bash shell ,
but oddly, it works fine in CMD.
zadjii-msft commentedon Sep 15, 2021
Also related: #4921
zadjii-msft commentedon Jul 25, 2022
Another example of cases where this is broken (and deserves a proper FAQ writeup): #13572
3N4N commentedon Jul 26, 2022
Does that mean there is a solution? I see above that Dustin was supposed to write one, but I can't find it.
Also, why does it not affect cmd? mikofski said so and I can confirm.
DHowett commentedon Jul 26, 2022
Huh. I should write this stuff down!
So, the reason it would apply in one shell and not the other is that they take different approaches to enabling/disabling the VT_PROCESSING mode for client applications.
I believe PowerShell explicitly turns VT off when it spawns a client and turns it back on before displaying the prompt, whereas CMD restores the original console mode when it spawns a client and turns it back on before displaying the prompt.
In this case, the difference between "turning VT off" and "restoring the original mode" becomes critically important: in Terminal, the original mode that CMD restores already has VT turned on, so when msys2 comes to save/restore the mode on its own, VT is already on.
tregusti commentedon Nov 7, 2022
Having the same issue when running Git bash in Terminal, executing Azure CLI commands.
Windows.Terminal: Version: 1.15.2874.0
Shell executable is
C:\Program Files\Git\bin\bash.exe.bash --version4.4.23(1)-releasegit --versiongit version 2.36.0.windows.1az --version