Repository navigation
Format-Table does not return null if the Console width is equal to 0. - #6883
Klaudia Algiz (kalgiz) wants to merge 12 commits into
Conversation
a8afc94 to
948b47c
Compare
There was a problem hiding this comment.
I think we should use try {} finally {} to ensure that the hook was turned off.
There was a problem hiding this comment.
Fixed.
There was a problem hiding this comment.
Should we check that console width is default (120)?
There was a problem hiding this comment.
Fixed.
There was a problem hiding this comment.
Maybe add in the comment that VSTS console width is 0 and we address this.
948b47c to
b741b1e
Compare
There was a problem hiding this comment.
The test (console width is default (120)) failed and this say the we have broken hook - Console.WindowWidth = 0 doesn't work.
The hook should be here:
if (Console.WindowWidth == 0 || InternalTestHooks.SetConsoleWidthToZero)There was a problem hiding this comment.
Fixed.
There was a problem hiding this comment.
The test is failed. It is incorrect test. Console.WindowWidth = 0 doesn't work.
We should have another way.
There was a problem hiding this comment.
Klaudia Algiz (@kalgiz) Please address the comment.
There was a problem hiding this comment.
Please replace aliases and correct formatting.
There was a problem hiding this comment.
Fixed.
There was a problem hiding this comment.
Please add new line.
There was a problem hiding this comment.
Fixed.
|
Klaudia Algiz (@kalgiz) The PR contains alien commits - please rebase. |
9465770 to
012739f
Compare
012739f to
902d657
Compare
|
Ilya (@iSazonov) I made the rebase. |
|
Steve Lee (@SteveL-MSFT) Aditya Patwardhan (@adityapatwardhan) Could you please review? |
| # Fill the console window with the string, so that it reaches its max width. | ||
| # Check if the max width is equal to default value (120), to test test hook set. | ||
| $testObject = @{ test = '1' * 200} | ||
| Format-Table -inputobject $testObject | Out-String -str | ForEach-Object {$_.length} | Sort-Object | Select-Object -Last 1 | Should -Be 120 |
There was a problem hiding this comment.
-str should be -Stream
There was a problem hiding this comment.
Klaudia Algiz (@kalgiz) Can you make these changes?
There was a problem hiding this comment.
Aditya Patwardhan (@adityapatwardhan) can you make that change in this PR so we can still take this?
There was a problem hiding this comment.
|
This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days. |
|
replaced by #7465 |
…erShell#7465) Default to DefaultConsoleWidth when DotNet says WindowWidth is 0 This resolves an issue in an environment like VSTS when pwsh is spawned and DotNet is not able to determine the Console Width. * Port changes from PowerShell#6883 by @kalgiz
PR Summary
Format-Table does not return null if the Console width is equal to 0.
Fixes: #6748
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature testsThis change is