-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
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
Execute these commands in cmd.exe:
1>outfile pwsh.exe -Command "Write-Error TEST"
type outfile
Expected behavior
C:\temp>1>outfile pwsh.exe -Command "Write-Error TEST"
Write-Error: TEST
C:\temp>type outfile
C:\temp>Actual behavior
C:\temp>1>outfile pwsh.exe -Command "Write-Error TEST"
C:\temp>type outfile
Write-Error: TEST
C:\temp>Error details
Environment data
Name Value
---- -----
PSVersion 7.5.4
PSEdition Core
GitCommitId 7.5.4
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.0Visuals
I'm executing pwsh in a cmd.exe console. When stdout is redirected to a file but stderr is not redirected, pwsh writes error messages to the file, while it should print the error in the cmd window.
When stdout and stderr are both redirected or neither redirected, the behavior seems correct.
C:\temp>pwsh.exe -Command "Write-Error TEST"
Write-Error: TEST <= This line is red in color
C:\temp>1>outfile pwsh.exe -Command "Write-Error TEST"
C:\temp>type outfile
Write-Error: TEST <= This line is red in color
C:\temp>1>outfile 2>errfile pwsh.exe -Command "Write-Error TEST"
C:\temp>type outfile
C:\temp>type errfile
Write-Error: TEST <= This line is red in color
C:\temp>
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime