public void WaitForExit(int milliseconds) { using (ProcessWaitHandle processWaitHandle = new ProcessWaitHandle(_processHandle)) { if (processWaitHandle.WaitOne(milliseconds)) { // This means the process exited while waiting. SetExitState(); } } }
public bool WaitForExit(int milliseconds) { using (var processWaitHandle = new ProcessWaitHandle(_processHandle)) { if (processWaitHandle.WaitOne(milliseconds)) { // This means the process exited while waiting. SetExitState(); return(true); } } return(false); }