Repository navigation
Closed
Labels
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Repro steps:
- Open the latest PowerShell preview.7, and make sure using the default prompt
- Run
$ErrorView = 'NormalView' - Run
Write-Error 'error'
This is a bug introduced by #17705.
The Cosnole.ForegroundColor and Console.BackgroundColor were changed but never set back after writing out the message.
Lines 1299 to 1307 in 1ee27cf
| if ($ErrorView -ne 'ConciseView' -and $null -ne $host.PrivateData) { | |
| if ($null -ne $host.PrivateData.ErrorForegroundColor) { | |
| [Console]::ForegroundColor = $host.PrivateData.ErrorForegroundColor | |
| } | |
| if ($null -ne $host.PrivateData.ErrorBackgroundColor) { | |
| [Console]::BackgroundColor = $host.PrivateData.ErrorBackgroundColor | |
| } | |
| } |
Expected behavior
The prompt after executing `Write-Error 'error'` doesn't have the color changedActual behavior
The prompt gets changed to the error colorError details
N/AEnvironment data
Name Value
---- -----
PSVersion 7.3.0-preview.7
PSEdition Core
GitCommitId 7.3.0-preview.7
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Activity
nightroman commentedon Aug 13, 2022
I experience this regression in the just released PowerShell 7.2.6.
PowerShell 7.2.5 works as expected.