-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
microsoft/playwright-dotnet
#2623Labels
area-System.Diagnostics.Processneeds-author-actionAn issue or pull request that requires more info or actions from the author.An issue or pull request that requires more info or actions from the author.
Milestone
Description
Description
When using System.Diagnostics.Process
with CreateNoWindow = true
the output does not get redirected to the parent process. It will end up in no output.
The docs don't say anything about this behaviour, thats why I'm opening this issue and CreateNoWindow
changes the behaviour if stdout/err gets redirected or not.
Reproduction Steps
using System.Diagnostics;
if (args.Length >= 1 && args[0] == "--start-process")
{
var currentExecutable = Environment.ProcessPath;
if (currentExecutable == null)
{
Console.Error.WriteLine("Could not get current executable path");
return;
}
var playwrightStartInfo = new ProcessStartInfo(currentExecutable)
{
UseShellExecute = false,
RedirectStandardError = false,
RedirectStandardOutput = false,
CreateNoWindow = true,
};
using var pwProcess = new Process()
{
StartInfo = playwrightStartInfo,
};
pwProcess.Start();
pwProcess.WaitForExit();
}
else
{
Console.WriteLine("Hello stdout!");
Console.Error.WriteLine("Hello stderr!");
}
Run it with ./bin/Debug/net6.0/dotnetrepro.exe --start-process
.
Expected behavior
Hello stderr!
and Hello stdout!
are getting printed.
Actual behavior
They get not printed.
Regression?
No response
Known Workarounds
Remove CreateNoWindow = true
.
or:
Using RedirectStandardError = true
and RedirectStandardOutput = true
and manually redirecting it to the parent stdout/stderr.
Configuration
I can only reproduce it on Windows 10 + 11 amd64.
Other information
PS C:\Users\maxsc\Desktop\dotnet-process-redirect-issue> dotnet --list-sdks
6.0.102 [C:\Program Files\dotnet\sdk]
Metadata
Metadata
Assignees
Labels
area-System.Diagnostics.Processneeds-author-actionAn issue or pull request that requires more info or actions from the author.An issue or pull request that requires more info or actions from the author.