runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Implement Console.SetWindowSize() for linux

Open HJLeee opened this issue 3 years ago • 2 comments

Implement Console.SetWindowSize() using the same system call with ConsoleGetWindowSize() (ioctl w/ set param TIOCSWINSZ).

HJLeee avatar Sep 19 '22 03:09 HJLeee

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Tagging subscribers to this area: @dotnet/area-system-console See info in area-owners.md if you want to be subscribed.

Issue Details

Implement Console.SetWindowSize() using the same system call with ConsoleGetWindowSize() (ioctl w/ set param TIOCSWINSZ).

Author: HJLeee
Assignees: -
Labels:

area-System.Console, new-api-needs-documentation

Milestone: -

ghost avatar Sep 19 '22 03:09 ghost

@stephentoub Would you review this please?

HJLeee avatar Sep 29 '22 05:09 HJLeee

Hi, Thank you for the testcase and review.

Which Terminal have you used for testing?

I've used my ubuntu 22.04 with screen-256color TERM and checked effectiveness with nvim as below. You can see nvim uses the value I set for testing.

· ~/dotnet/tests/winsize $ cat Program.cs
// See https://aka.ms/new-console-template for more information
Console.SetWindowSize(80,30);
Console.WriteLine("Width: {0}, Height: {1}", Console.WindowWidth, Console.WindowHeight);

캡처

HJLeee avatar Oct 31 '22 21:10 HJLeee

Rebased and force pushed to resolve conflict.

HJLeee avatar Oct 31 '22 21:10 HJLeee

src/libraries/apicompat/ApiCompat.proj(50,5): error CP0014: (NETCORE_ENGINEERING_TELEMETRY=Build) Cannot remove attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")' from 'System.Console.WindowHeight.get'.

@ViktorHofer we want to introduce this change on purpose, what is needed to make the CI green in such case?

adamsitnik avatar Nov 04 '22 14:11 adamsitnik

Replied offline:

You will need to add the compatibility difference to the suppression file that is used when comparing net7.0 against net6.0: runtime/ApiCompatBaseline.NetCoreAppLatestStable.xml at main · dotnet/runtime (github.com). You can either hand-edit it or use the following command to update it: dotnet.cmd src/libraries/apicompat --no-dependencies /p:GenerateCompatibilitySuppressionFile=true

ViktorHofer avatar Nov 04 '22 15:11 ViktorHofer

@ViktorHofer I've done that and pushed the changes. I can perform a full clean build now (build -c Release -subset clr+libs+libs.tests) on both Windows and Linux, but the CI is still failing with the old error message (before the fix I was getting the same error locally). Do you have any idea why?

adamsitnik avatar Nov 04 '22 20:11 adamsitnik

@ViktorHofer I've done that and pushed the changes. I can perform a full clean build now (build -c Release -subset clr+libs+libs.tests) on both Windows and Linux, but the CI is still failing with the old error message (before the fix I was getting the same error locally). Do you have any idea why?

Looking now

ViktorHofer avatar Nov 07 '22 10:11 ViktorHofer

The build is passing for me locally as well and I diffed the binlogs from the failing run and the local one. There aren't any differences that would explain this behavior.

After spending some time on it, I just noticed that CI wasn't triggered for your commit :(

ViktorHofer avatar Nov 07 '22 11:11 ViktorHofer

/azp run dotnet-linker-tests

ViktorHofer avatar Nov 07 '22 11:11 ViktorHofer

/azp run runtime-dev-innerloop

ViktorHofer avatar Nov 07 '22 11:11 ViktorHofer

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Nov 07 '22 11:11 azure-pipelines[bot]

/azp run runtime

ViktorHofer avatar Nov 07 '22 11:11 ViktorHofer

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Nov 07 '22 11:11 azure-pipelines[bot]

/azp run runtime-staging

ViktorHofer avatar Nov 07 '22 11:11 ViktorHofer

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Nov 07 '22 11:11 azure-pipelines[bot]

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Nov 07 '22 11:11 azure-pipelines[bot]

Wow. Thank you for APICompat and CI stuff. 😄

HJLeee avatar Nov 08 '22 09:11 HJLeee