public static WaitForExitAsync ( |
||
process | ||
return | Task |
public static Task<int> WaitForExitAsync(Process process)
{
var tcs = new TaskCompletionSource<int>();
process.EnableRaisingEvents = true;
process.Exited += (sender, args) => tcs.TrySetResult(process.ExitCode);
return tcs.Task;
}
}