Raw ANSI escape codes get printed on Windows, on some places, but not on others
rotemdan opened this issue · comments
Hey @rotemdan 👋, I have finally been able to get a Windows computer and try to reproduce the issue (sorry for the late response).
Which version are you using (windows and VsCode) ? I have opened Visual Studio Code on Windows 11 and was unable to reproduce the issue. The ANSI escape codes weren't showing
(And by the way, you're right. The error is not needed in this case. gut
should handle CTRL+C termination.)
Hi,
I apologize for the very late response.
I have been busy, and I cannot access a Windows computer frequently.
Replication
I have tried to replicate this issue, but unfortunately, I can't.
I don't see any ANSI codes even when using cmd
.
Potential fix
After doing some research, I discovered that Windows started supporting ANSI color code from Windows 10 TH2 (https://superuser.com/a/1050078).
What is your Windows version ? Mine is:
I'm using:
Windows 10 Pro
Version: 22H2
OS Build: 19045.3570
Experience: Windows Feature Experience Pack 1000.19052.1000.0
In my Node.js applications I use the chalk library to add colors to terminal outputs, and it doesn't have this issue.
I saw in the code that you're using these libraries for color:
import (
"github.com/charmbracelet/lipgloss"
printColor "github.com/fatih/color"
)
Maybe one or both of them are not tested on Windows 10?
Thank you. It's not an issue with the Windows version.
I believe the issue is related to fatih/color
.
Can you please run gut remote
and screenshot the results ?
Normally, the raw ANSI codes should not show up if I have correctly identified the root cause.
My version is is still v0.2.10
(I tried to update using scoop
). The issue still happens (I don't think the version is any different than before).
Do I need to compile the latest repository version to use the version you're referring to?
I haven't used Go in many years. Maybe you can attach a precompiled binary for Windows (if possible)?
I don't want to bother you with compiling. You are already kind enough to help solve this issue.
gut
prints colors using three different methods. The one used by gut whereami
is faulty. I want to check if the one used by gut remote
is faulty too.
You don't need to recompile. Just run gut remote
with your current version.
If no escape codes are shown, I would have identified the bug.
Thank you !
I know where the issue is coming from.
I must change the way gut
prints the text (fatih/color#154 (comment))
I will ping you when I release the patch
Hi @rotemdan,
I have pushed a fix in v0.3.0.
Please check if the issue is now resolved.