In .NET you should call Process.WaitForExit() to ensures that all processing has been completed, including the handling of asynchronous events for redirected standard output.
Process p = Process.Start(...);
while (!p.WaitForExit(1000)) {}
// call WaitForExit() here to ensures that all processing has been completed
p.WaitForExit();
In .NET 5 there is a new method Process.WaitForExitAsync(CancellationToken). Should we call WaitForExit after Process.WaitForExitAsync?
Process p = Process.Start(...);
await p.WaitForExitAsync(cancellationToken);
// Is it necessary to ensures that all processing has been completed?
p.WaitForExit();