task icon indicating copy to clipboard operation
task copied to clipboard

fix color on Windows

Open nichady opened this issue 2 years ago • 6 comments

fixes #343

Here's a before and after for one of my Taskfile projects

before fix: image

after: image

nichady avatar Dec 20 '21 03:12 nichady

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:)

viktorasm avatar Jul 01 '22 18:07 viktorasm

@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 avatar Aug 28 '22 05:08 jcrben

@jcrben I see no harm in this honestly. How do we test this behavior?

ghostsquad avatar Aug 29 '22 00:08 ghostsquad

@jcrben @ghostsquad

  1. Use Windows, having "go (language)" installed.
  2. Use Visual Studio Code and its terminal(s) - git-bash (recommended), cmd.exe (untested), powershell (untested).
  3. 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.
  4. 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).
  5. Cherry-pick @nichady's commit atop the currently checked-out branch/tag.
  6. 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.
  7. 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).

VictorYap-at-Symend avatar Aug 29 '22 13:08 VictorYap-at-Symend

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

andreynering avatar Aug 29 '22 13:08 andreynering

I have a secondary Windows machine to debug this, just need to find the time...

andreynering avatar Aug 29 '22 13:08 andreynering

Closing this. See comment.

pd93 avatar Jun 27 '23 09:06 pd93