You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change the behavior of Out-File and Out-String regarding $PSStyle.OutputRendering #8892
The changes in this PR update the behavior of Out-File and Out-String regarding the RenderingOutput setting to be the following:
when the input object is pure string, these 2 cmdlets keep the string input unchanged regardless of the RenderingOutput setting
when the input object needs to have formatting views applied to it, these 2 cmdlets remove escape sequences from the formatting output strings based on the RenderingOutput setting.
We should call out that $PSStyle.OutputRendering affect formatting and text rendering on console screen, but it doesn't affect other scenarios. Example, $PSStyle.Foreground.Red + "abc" + $PSStyle.Reset | % { $_.Length } returns 12 regardless of $PSStyle.OutputRendering.
Out-File and Out-String respect $PSStyle.OutputRendering when the piped-in object needs to be applied with formatting views. Otherwise, it keeps the escape sequences regardless of $PSStyle.OutputRendering, such as when the piped-in object are pure strings.
Activity