internal override int Exec() { ProcStartInfo.RedirectStandardOutput = true; ProcStartInfo.RedirectStandardError = true; InitProcess(); using (Proc) { Proc.OutputDataReceived += DataReceived; Proc.BeginOutputReadLine(); Proc.ErrorDataReceived += DataReceived; Proc.BeginErrorReadLine(); RunCommands(); var interrupted = false; while (!interrupted && !Proc.HasExited) { interrupted = !Proc.WaitForExit(_outputWaitingLimit); } if (Debugger.IsAttached) { System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1)); } Throw(interrupted, Proc.ExitCode); return(Proc.ExitCode); } }