Description
Version: DotNet Core 3.1
OS: MacOSX Catalina
Right now I am using "open -W" as a workaround but it's not ideal.
Additionally, differences in how MacOS handles Applications means that even if it did work as intended, in most cases we actually want to monitor the spawned child process. Opening TextEdit will in fact invoke TextEdit, but will wait on the entire TextEdit application to exit and not just the opened file.
Correct me if I am wrong, but there is presently no way in .NET to obtain the child PID except by calling Process.GetProcesses() and hoping you select the right one.
Expected behavior: For it to work.
Actual behavior: It does not work.
Ideal behavior: Return the child process if there is one, likely not possible since the invoked application will be the only one aware of the PID.
using (var process = Process.Start("chrome", "www.bing.com"))
{
process.WaitForExit();
}
Some Googling reveals people encountering similar issues.
dotnet/corefx/Process.OSX.cs:48 shows that it is invoking open; so I am getting the PID of open and not even the spawned application, explaining why Exited immediately fires.