BenchmarkDotNet icon indicating copy to clipboard operation
BenchmarkDotNet copied to clipboard

Running on Linux leaves terminal colors changed

Open bartonjs opened this issue 3 years ago • 2 comments
trafficstars

After running BDN on Linux I see my terminal colors modified.

SSH via PuTTY with xterm, .NET 6, BDN 0.13.2, Ubuntu 18.04. (Similar results were seen with xterm-256color)

  • A successful run leaves the foreground color as yellow.
  • A filter that has no matches, and no suggestions, leaves the foreground color as red.
  • A filter that has no matches, and some suggestions, seems to leave the foreground color alone.
  • Using [DisassemblyDiagnoser], which yields Unknown Acknowledgment failures, leaves the foreground color as yellow.
  • The benchmark throwing an exception leaves the foreground color as yellow.

It's hard to say how many of those yellows are the same, of course.

Filter mismatch: image

Successful run start: image

Successful run end: image

bartonjs avatar Aug 26 '22 17:08 bartonjs

Looking at the pictures again... it may be "the terminal foreground becomes whatever color was the first one written"

bartonjs avatar Aug 26 '22 17:08 bartonjs

The Unknown Acknowledgment error is #2070

MichalPetryka avatar Aug 26 '22 17:08 MichalPetryka

Hint for potential contributor who wants to work on it: we revert the colors here:

https://github.com/dotnet/BenchmarkDotNet/blob/63e28c100a42a6492d09a0b93a8a4c141061bb0d/src/BenchmarkDotNet/Loggers/ConsoleLogger.cs#L44-L58

and this is most likely the part of the code that needs to be fixed.

adamsitnik avatar Oct 05 '22 10:10 adamsitnik

I would like to work on this. please assign it to me.

farQtech avatar Oct 12 '22 12:10 farQtech

I would like to work on this. please assign it to me.

@farQtech done! Please let me know if you need any help

adamsitnik avatar Oct 12 '22 18:10 adamsitnik

Sure @adamsitnik , thanks!!

farQtech avatar Oct 12 '22 18:10 farQtech

Hi @adamsitnik sorry for the delay, raised PR #2160 to fix above problem. I think it would be better if we restore ForegroundColor to it's original value once we are done. Please let me know your thoughts on this.

farQtech avatar Oct 18 '22 09:10 farQtech

Fixed by #2160, thanks a lot @farQtech !

adamsitnik avatar Oct 18 '22 11:10 adamsitnik