v3: color output doesn't work properly on Windows
- Task version: 3.0.0-preview4
- Windows version: Windows 10 Enterprise 1909 64-bit
Taskfile.yml:
# https://taskfile.dev
version: '3'
tasks:
default:
cmds:
- winver
Color output doesn't work in cmd.exe and powershell.exe:

Works well in ConEmu and Terminal:

With version: '2', it works well in ConEmu and Terminal (with no color), but still fails in cmd.exe and powershell.exe:

Maybe mattn's colorable is a good solution?
Just got hit by that. Command help hints that it should be possible to disable colored output, there is a flag to enable it, but it is enabled by default.
Options:
-c, --color colored output (default true)
Either --no-color or #459 should be available for us poor windows users without color :(
an alternative is to use --color=false . does that work on your end?
an alternative is to use
--color=false. does that work on your end?
That seems to have no effect on windows (v3.3.0)
❯ task --color=false test
←[0mtask: Command........
Hi everybody, thanks for reporting this!
No sure what's happening on Windows. By the screenshots seems that it's not supported on CMD. Did anyone try on PowerShell?
--color=false is supported and does work on macOS. Need to check on Windows to see what's happening...
Anyway, just added support for NO_COLOR=1 as well so perhaps that works for now...
- https://github.com/go-task/task/issues/459
- https://github.com/fatih/color/pull/137
No sure what's happening on Windows. By the screenshots seems that it's not supported on CMD. Did anyone try on PowerShell?
I am on PowerShell Core (Run: pwsh.exe)
--color=falseis supported and does work on macOS. Need to check on Windows to see what's happening... Anyway, just added support forNO_COLOR=1as well so perhaps that works for now...
Testing:
❯ task test
←[32mtask: [test] echo "hello go-task"
←[0mhello go-task
❯ task test --color=false
←[0mtask: [test] echo "hello go-task"
←[0mhello go-task
❯ $env:NO_COLOR=1
❯ task test
task: [test] echo "hello go-task"
hello go-task
I've investigated a bit this issue and found out some things. If you run a task that has more than one task as dependency the colored output doesn't work only for the first one, subsequent ones will have no issues.
e.g. Running this:
python:lint:
desc: Lint Python code
deps:
- task: poetry:install-deps
cmds:
- poetry run flake8 --show-source
produces this:

This line is the "culprit": https://github.com/go-task/task/blob/6c73ab823b5e34430eacbb7b2ec14bd80995a58b/internal/execext/exec.go#L58
You can easily verify that's the cause by changing that line to:
logger.Blue()(opts.Stdout, "NOT COLORED FIRST TIME\n")
err = r.Run(ctx, p)
logger.Blue()(opts.Stdout, "COLORED ALWAYS\n")
return err
This is the result:

Am not sure how to best fix this issue, I don't have enough knowledge about the codebase. There's probably some strange thing going on with stdout and stderr. 😕
Hope this helps.
I've just tried the sample on Windows 11 with Task v3.26 on both cmd and powershell and it looks fine to me. Since this was reported in the Task v3 preview and no-one has commented or referenced this issue for nearly 2 years, I'm going to close it.
If anyone is still having this problem or thinks this isn't fixed, please open a new issue with steps to reproduce it.