/// <summary> /// Start the process synchronously /// </summary> public bool DoWait(bool hidden = false) { StandardOutput.Clear(); ErrorOutput.Clear(); if (hidden) { StartInfo.CreateNoWindow = true; StartInfo.WindowStyle = ProcessWindowStyle.Hidden; } if (!string.IsNullOrEmpty(Arguments)) { StartInfo.Arguments = Arguments; } if (_nbExecution > 0) { Kill(); } _nbExecution++; if (_process == null) { _process = new Process { StartInfo = StartInfo }; _process.OutputDataReceived += (sender, args) => StandardOutput.AppendLine(args.Data); _process.ErrorDataReceived += (sender, args) => ErrorOutput.AppendLine(args.Data); } _process.Start(); _process.WaitForExit(); ExitCode = _process.ExitCode; return(ExitCode == 0); }