After piping git log | less and then pressing Q to quit, the PowerShell prompt displayed in Windows Terminal shows character codes, instead of being colored.
Environment
Windows build number: 10.0.19042.0
Windows Terminal version (if applicable): 1.4.3243.0
Any other software?
PowerShell Core: 7.1.0
Steps to reproduce
-
Open PowerShell Core in Windows Termianl
-
Set the prompt to be colored with ANSI escape codes:
function prompt { "`e[38;2;0;255;0mMyPrompt`e[0m>" }
-
Run git log | less. Using full paths here:
& 'C:\Program Files\Git\bin\git.exe' log | & 'C:\Program Files\Git\usr\bin\less.exe'
-
Press Q to quit log.
Expected behavior
Should see "MyPrompt>" in green.
Actual behavior
Prompt looks like this:
←[38;2;0;255;0mMyPrompt←[0m>
Workaround
The problem does not occur if Control+C is used to quit less.exe instead of Q.
The problem does not occur if Out-Host -Paging is used instead of less.exe.
& 'C:\Program Files\Git\bin\git.exe' log | Out-Host -Paging
After piping
git log | lessand then pressing Q to quit, the PowerShell prompt displayed in Windows Terminal shows character codes, instead of being colored.Environment
Steps to reproduce
Open PowerShell Core in Windows Termianl
Set the prompt to be colored with ANSI escape codes:
Run git log | less. Using full paths here:
Press Q to quit log.
Expected behavior
Should see "MyPrompt>" in green.
Actual behavior
Prompt looks like this:
Workaround
The problem does not occur if Control+C is used to quit less.exe instead of Q.
The problem does not occur if
Out-Host -Pagingis used instead of less.exe.