Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .NET 6.0 env variable for color output #2113

Merged
merged 4 commits into from Apr 21, 2022
Merged

Conversation

NickCraver
Copy link
Collaborator

See dotnet/runtime#47935 for details, basically enables color output even though console output is redirected for a better time in GitHub actions.

See dotnet/runtime#47935 for details, basically enables color output even though console output is redirected for a better time in GitHub actions.
@Tyrrrz
Copy link
Contributor

Tyrrrz commented Apr 20, 2022

Relevant: created an issue on setup-dotnet to have it enabled by default
actions/setup-dotnet#288

@NickCraver
Copy link
Collaborator Author

@Tyrrrz so....I can't get it to work at all, maybe I'm holding it wrong? It'd only work on Unix either way but...yeah, it doesn't seem to do anything here. There's something else in play I guess but don't want to spend a day figuring it out. This is way, way harder than it should be though.

@Tyrrrz
Copy link
Contributor

Tyrrrz commented Apr 20, 2022

@Tyrrrz so....I can't get it to work at all, maybe I'm holding it wrong? It'd only work on Unix either way but...yeah, it doesn't seem to do anything here. There's something else in play I guess but don't want to spend a day figuring it out. This is way, way harder than it should be though.

Hmm, I tested it locally with dotnet test > 1.txt while flipping the env var to different states and all produced files were without colors.

@0xced sorry for tagging you, do you know what could be wrong?

Update: apparently it's not supposed to work on Windows, where I was testing it. I tested it on Linux too and it works there when redirected to a file -- so the issue is probably on the GitHub Actions side somehow?

@Tyrrrz
Copy link
Contributor

Tyrrrz commented Apr 20, 2022

FYI: I created a simple repro, in case you can forward it to relevant people
https://github.com/Tyrrrz/TestDotnetColors/actions/runs/2198482246

And started a discussion: dotnet/runtime#68302

@xt0rted
Copy link

xt0rted commented Apr 21, 2022

This issue came up in dotnet/command-line-api#1710. I thought it was something that was needed in System.CommandLine (hence asking about the new feature for it) but was told this env var should be all that's needed. I can't get it to work though. In my own dotnet local tool I can output ansi color codes and get color in the build log but I can't get the dotnet cli itself to output color.

@Tyrrrz
Copy link
Contributor

Tyrrrz commented Apr 21, 2022

This issue came up in dotnet/command-line-api#1710. I thought it was something that was needed in System.CommandLine (hence asking about the new feature for it) but was told this env var should be all that's needed. I can't get it to work though. In my own dotnet local tool I can output ansi color codes and get color in the build log but I can't get the dotnet cli itself to output color.

I'm definitely able to get dotnet CLI to output color codes but not on GitHub Actions.

@Tyrrrz
Copy link
Contributor

Tyrrrz commented Apr 21, 2022

@am11 provided a fix here: dotnet/runtime#68302 (comment)

Copy link
Contributor

@Tyrrrz Tyrrrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work @NickCraver

.github/workflows/CI.yml Show resolved Hide resolved
.github/workflows/CI.yml Outdated Show resolved Hide resolved
Update `TERM`

Co-authored-by: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com>
@NickCraver
Copy link
Collaborator Author

Thanks both! I opened an issue to see if we can get this working in Windows as well: dotnet/runtime#68340

@NickCraver NickCraver merged commit d3e26c4 into main Apr 21, 2022
@NickCraver NickCraver deleted the craver/build-color-output branch April 21, 2022 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants