When I run a C# console application, it creates a parallel process; now, my main application threads must wait until the process created under it is closed; however, in my case, the main ui thread exited when the process start code was executed; it did not wait for the created process to end.
var processInfo = new ProcessStartInfo(command)
{
UseShellExecute = false,
};
var process = new Process();
process.StartInfo = processInfo;
process.Start();
Console.WriteLine("This line should be print after the process ended");
How do I keep the main UI thread waiting until the process I've started completes?