task
task copied to clipboard
fix color on Windows
fixes #343
Here's a before and after for one of my Taskfile projects
before fix:
after:
Having no option to turn off colors permanently (nobody wants to re-type env variable) is a big issue for windows users. Please get this merged:)
@ghostsquad @andreynering thoughts? I had thought this might have something to do with https://github.com/microsoft/terminal/issues/6634 since I noticed it using the Microsoft Terminal but not sure about that
@jcrben I see no harm in this honestly. How do we test this behavior?
@jcrben @ghostsquad
- Use Windows, having "go (language)" installed.
- Use Visual Studio Code and its terminal(s) - git-bash (recommended), cmd.exe (untested), powershell (untested).
- Checkout and install some stable branch/tag of "go-task"
- if you tweak the "version" variable and do
task.exe --version
, that could help you be more confidence that you're using a custom build.
- if you tweak the "version" variable and do
- Using that freshly created
task.exe
binary to run some Taskfile for some dummy project/solution that somehow outputs colours. Note that it's mangled (see initial screenshot). - Cherry-pick @nichady's commit atop the currently checked-out branch/tag.
- Rebuild the binary and install it
- if you tweak the "version" variable and do
task.exe --version
, that could help you be more confidence that you're using a custom build.
- if you tweak the "version" variable and do
- Re-run the Taskfile and the result should be colourized output instead of mangled colour codes.
(optionally) Re-install "go-task" to get back to an official release, if you like.
I've been happy with the results atop 3.3.0 and some other relatively recent "latest tag" too (probably 3.14.1).
Sorry for taking so long to review this.
I'm not sure what is happening on Windows, but the change in this PR is is certainly not the right way to implement this, sorry. It would have side-effect and cause other bugs.
I think the problem may be related to "reset" being used for white here (but I'm not sure, we need to debug that):
https://github.com/go-task/task/blob/421cb522d9a6874bd072491bbc466dd5300acae2/internal/logger/logger.go#L15
I have a secondary Windows machine to debug this, just need to find the time...
Closing this. See comment.