-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Closed
Copy link
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the product
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
When I redirect the output and error streams of a native command to two separate files (when I know the command writes to the error stream), both files are created but they are both empty. The error file should contain content. If I redirect only the error stream, the file will contain the correct content.
Here I'm using dotnet as an example but the same thing happens with other commands. If you run dotnet garbage it will write to the error stream.
dotnet >x.txt 2>y.txt garbage
Expected behavior
PS> dotnet >x.txt 2>y.txt garbage
PS> Get-Content y.txt
The command could not be loaded, possibly because:
* You intended to execute a .NET application:
The application 'garbage' does not exist.
* You intended to execute a .NET SDK command:
No .NET SDKs were found.
Download a .NET SDK:
https://aka.ms/dotnet-download
Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-foundActual behavior
PS> dotnet >x.txt 2>y.txt garbage
PS> Get-Content y.txt
PS> dotnet 2>y.txt garbage
PS> Get-Content y.txt
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-garbage does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.Error details
N/AEnvironment data
Name Value
---- -----
PSVersion 7.4.0
PSEdition Core
GitCommitId 7.4.0
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
mklement0, haltcase, nogov, satyapramodh and sourcenouveauJaykul
Metadata
Metadata
Assignees
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the product

