-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Console.Unix: fix ANSI colors over redirected standard output. #95654
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
Conversation
Tagging subscribers to this area: @dotnet/area-system-console Issue DetailsThis fixes a regression that was introduced in #94414. ANSI colors always need to be sent to standard output. The @adamsitnik @dotnet/area-system-console ptal.
|
Beside the updated tests, the test suite is also failing for me on the
The terminal accepts the size instead of giving an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix LGTM but I am not sure whether we should update the failing tests or restore old parameter names in the argument exceptions.
We can either split it into two PRs or wait for @stephentoub answer.
Thank you for your contribution @tmds !
I did not, I meant #75824. Thanks for pointing this out and apologies for the confusion. |
@@ -559,7 +559,7 @@ public void SetWindowPosition_Unix_ThrowsPlatformNotSupportedException() | |||
Assert.Throws<PlatformNotSupportedException>(() => Console.SetWindowPosition(50, 50)); | |||
} | |||
|
|||
[PlatformSpecific((TestPlatforms.Windows) | (TestPlatforms.AnyUnix & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.tvOS))] | |||
[PlatformSpecific((TestPlatforms.Windows)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated this to be skipped on Unix.
When I run it, I get no error from the kernel when setting these sizes.
And even if there were an error, Console.Unix
has no code to turn it into the ArgumentOutOfRangeException
this test expects.
On Windows, does calling Console.SetWindowSize
resizes the visual window?
If it does, I'm not seeing this with Gnome terminal.
I think TIOCSWINSZ
may be meant to inform the kernel about the actual size, instead of requesting a different one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments are not related to the issue being fixed here.
Unless we know for sure Console.SetWindowSize
works as expected on Unix/Linux, we can create a new issue to look into this further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can create a new issue to look into this further.
I've created #96208 for this.
12b2b69
to
62b1a44
Compare
This should be good to merge. |
@adamsitnik is this good to merge? And can you share your thoughts on #95654 (comment)? |
@adamsitnik or @danmoseley can you merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the args question, lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @tmds!
This fixes a regression that was introduced in #94414.
ANSI colors always need to be sent to standard output.
The
Color.RedirectedOutput_EnvVarSet_EmitsAnsiCodes
test caught the regression.@adamsitnik @dotnet/area-system-console ptal.