-
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.
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
I ran across this by accident while trying to workaround issue #20747.
If I'm using PowerShell 7.4.0 and I invoke pwsh with -Command and I redirect the output of pwsh to a file, that file ends up containing CLIXML with an encoded version of the output rather than the actual output, as happens in 7.3.10
When doing this with a script and pwsh -File things work as expected.
This appears to be related to the PR: Support byte stream piping between native commands and file redirection by @SeeminglyScience that was added in preview 4.
Expected behavior
PS> pwsh >x.txt -Command { Write-Output "Hello" }
PS> Get-Content x.txt
HelloActual behavior
PS> pwsh >x.txt -Command { Write-Output "Hello" }
PS> Get-Content x.txt
#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Output">Hello</S></Objs>Error details
No error invovled.Environment 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
7.3.10
7.4.0
mklement0 and geek96boolean10
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.

