private void ReportExecBegin() { if (!_quietBuildReporter) { BuildReporter.BeginSection("EXEC", FormatProcessInfo(_process.StartInfo, includeWorkingDirectory: false)); } }
public CommandResult Execute() { ThrowIfRunning(); _running = true; if (_process.StartInfo.RedirectStandardOutput) { _process.OutputDataReceived += (sender, args) => { ProcessData(args.Data, _stdOutCapture, _stdOutForward, _stdOutHandler); }; } if (_process.StartInfo.RedirectStandardError) { _process.ErrorDataReceived += (sender, args) => { ProcessData(args.Data, _stdErrCapture, _stdErrForward, _stdErrHandler); }; } _process.EnableRaisingEvents = true; var sw = Stopwatch.StartNew(); BuildReporter.BeginSection("EXEC", FormatProcessInfo(_process.StartInfo)); _process.Start(); if (_process.StartInfo.RedirectStandardOutput) { _process.BeginOutputReadLine(); } if (_process.StartInfo.RedirectStandardError) { _process.BeginErrorReadLine(); } _process.WaitForExit(); var exitCode = _process.ExitCode; var message = $"{FormatProcessInfo(_process.StartInfo)} exited with {exitCode}"; if (exitCode == 0) { BuildReporter.EndSection("EXEC", message.Green(), success: true); } else { BuildReporter.EndSection("EXEC", message.Red().Bold(), success: false); } return(new CommandResult( _process.StartInfo, exitCode, _stdOutCapture?.GetStringBuilder()?.ToString(), _stdErrCapture?.GetStringBuilder()?.ToString())); }
private void ReportExecBegin() { if (!_quietBuildReporter) { BuildReporter.BeginSection("EXEC", FormatProcessInfo(_process.StartInfo)); } }
private BuildTargetResult ExecTarget(BuildTarget target) { var sectionName = $"{target.Name.PadRight(_maxTargetLen + 2).Yellow()} ({target.Source.White()})"; BuildReporter.BeginSection("TARGET", sectionName); BuildTargetResult result; // Run the dependencies var dependencyResults = new Dictionary <string, BuildTargetResult>(); var failedDependencyResult = RunDependencies(target, dependencyResults); if (failedDependencyResult != null) { result = failedDependencyResult; } else if (target.Body != null) { try { result = target.Body(new BuildTargetContext(this, target, dependencyResults)); } catch (Exception ex) { result = new BuildTargetResult(target, success: false, exception: ex); } } else { result = new BuildTargetResult(target, success: true); } BuildReporter.EndSection("TARGET", sectionName, result.Success); return(result); }