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

Fake coloured text output leaves console colours changed on exit in some circumstances #2173

Closed
SteveGilham opened this issue Oct 28, 2018 · 4 comments
Labels

Comments

@SteveGilham
Copy link
Contributor

Description

In a Windows PowerShell console with screen text set to White, running a fake script through dotnet fake can exit with a display colour sticking like
2018-10-28
2018-10-28 1

Here the yellow from the warnings has persisted, but depending on the script and the state of the system being built, red, green or light grey can stick instead

Repro steps

Please provide the steps required to reproduce the problem

  1. In a Windows PowerShell console, with default colurs (white on dark blue) navigate to a local FAKE repo

  2. execute dotnet fake run .\build.fsx --target DotNetCoreUnitTests a number of times

Expected behavior

System colours are preserved always.

Actual behavior

See picture above for an example.

Known workarounds

Save Console.ForegroundColor ,and, to be paranoid, Console.BackgroundColor, on entry to the script, and then execute a final target to set the colours to the saved values.

Related information

  • Operating system -- WinX home
  • Branch -- released versions, also current release/next
  • .NET Runtime, CoreCLR or Mono Version -- .net 4.7 and various .net core
  • Indications of severity -- cosmetic
  • Version of FAKE (4.X, 5.X) 5.x pre-release certainly, can't remember if seen in 4.x
@BlythMeister
Copy link
Contributor

The issue here is the way fake sets and resets console colour in the listener.

It should use

Console.ResetColor()

Rather than saving the colour and then resetting it manually

@matthid
Copy link
Member

matthid commented Oct 29, 2018

@BlythMeister While ResetColor might fix this it would be interesting to know why the current code wouldn't work. AFAIK we serialize everything to a single mailbox processor which should take care of everything?

@matthid
Copy link
Member

matthid commented Oct 29, 2018

Or hm, maybe we have indeed two places where we write, one in the fake-runtime and one in Fake.Core.Trace

@matthid matthid added the bug label Apr 28, 2019
@matthid matthid closed this as completed in 8363549 Jun 9, 2019
@matthid
Copy link
Member

matthid commented Jun 9, 2019

Related: #1858 haf/expecto#249
Please re-open (or open a new issue) if you encounter this with a runner > 5.14 (which will be released soon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants