Skip to content

Fix ConciseView to handle case where there isn't a console to obtain the width - #11784

Merged
Ilya (iSazonov) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:concise-width
Feb 12, 2020
Merged

Ilya (iSazonov) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:concise-width

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Feb 5, 2020 •

Copy link
Copy Markdown
Member

PR Summary

ConciseView relied on the window width for calculating line wrapping. In the case where PowerShell is run on a system without a console, the call to get the console windowwidth throws. Fix is to wrap the use of [Console]::WindowWidth in a try..catch and use a default value for the width if it throws.

PR Context

Fix #11776

PR Checklist

@iSazonov Ilya (iSazonov) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Feb 6, 2020
@iSazonov Ilya (iSazonov) added this to the 7.1.0-preview.1 milestone Feb 6, 2020
@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Ilya (@iSazonov) can you merge this so I can make a fix for the other issue with these changes to avoid a merge conflict?

@iSazonov
Ilya (iSazonov) merged commit 5edafb6 into PowerShell:master Feb 12, 2020
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the concise-width branch February 12, 2020 14:48
@ghost

Copy link
Copy Markdown

🎉v7.1.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in Formatting while being without console

3 participants