Prerequisites
Steps to reproduce
#25875
See example code at https://github.com/rhubarb-geek-nz/pipe-dream
t1 is a console app
t2 and t3 are window apps
All three write to stdout.
With PowerShell piping output from t1.exe to a file works.
With PowerShell redirecting output from t2.exe and t3.exe to a file creates an empty file.
The working assumption is that PowerShell creates a pipe for stdout and does the writing to the file itself rather than handing the file handle to the child.
Because the app is not a console app it does not wait for the process to finish.
However, because it should be reading from a pipe and writing to a file, when the process terminates is irrelevant, it should wait for the end of file on the pipe.
Using
.\t2.exe | Out-String -Stream
Does work as expected and shows that the stdout can be processed from a windows application.
Expected behavior
That redirecting output from a windows app will write all stdout content to a file.
Actual behavior
Redirection output from a windows app to a file creates an empty file
Error details
Environment data
Name Value
---- -----
PSVersion 7.6.6
PSEdition Core
GitCommitId 7.6.6
OS Microsoft Windows 10.0.26200
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
#25875
See example code at https://github.com/rhubarb-geek-nz/pipe-dream
t1 is a console app
t2 and t3 are window apps
All three write to stdout.
With PowerShell piping output from t1.exe to a file works.
With PowerShell redirecting output from t2.exe and t3.exe to a file creates an empty file.
The working assumption is that PowerShell creates a pipe for stdout and does the writing to the file itself rather than handing the file handle to the child.
Because the app is not a console app it does not wait for the process to finish.
However, because it should be reading from a pipe and writing to a file, when the process terminates is irrelevant, it should wait for the end of file on the pipe.
Using
Does work as expected and shows that the
stdoutcan be processed from a windows application.Expected behavior
That redirecting output from a windows app will write all stdout content to a file.Actual behavior
Redirection output from a windows app to a file creates an empty fileError details
File contains zero bytesEnvironment data
Visuals
No response