diff --git a/src/tasks/Common/Utils.cs b/src/tasks/Common/Utils.cs index 5cb001a633429d4bbc81dc8505b40ff5c464f4a9..696ef14d85e80bd76e290e94f96eb0e87e7abbef 100644 --- a/src/tasks/Common/Utils.cs +++ b/src/tasks/Common/Utils.cs @@ -33,7 +33,6 @@ public static string GetEmbeddedResource(string file) { LogInfo($"Running: {path} {args}", debugMessageImportance); var outputBuilder = new StringBuilder(); - var errorBuilder = new StringBuilder(); var processStartInfo = new ProcessStartInfo { FileName = path, @@ -72,9 +71,8 @@ public static string GetEmbeddedResource(string file) if (!silent) { LogWarning(e.Data); - outputBuilder.AppendLine(e.Data); } - errorBuilder.AppendLine(e.Data); + outputBuilder.AppendLine(e.Data); } }; process.OutputDataReceived += (sender, e) => @@ -84,8 +82,8 @@ public static string GetEmbeddedResource(string file) if (!silent) { LogInfo(e.Data, outputMessageImportance); - outputBuilder.AppendLine(e.Data); } + outputBuilder.AppendLine(e.Data); } }; process.BeginOutputReadLine(); @@ -96,10 +94,10 @@ public static string GetEmbeddedResource(string file) { Logger?.LogMessage(MessageImportance.High, $"Exit code: {process.ExitCode}"); if (!ignoreErrors) - throw new Exception("Error: Process returned non-zero exit code: " + errorBuilder); + throw new Exception("Error: Process returned non-zero exit code: " + outputBuilder); } - return outputBuilder.ToString().Trim('\r', '\n'); + return silent ? string.Empty : outputBuilder.ToString().Trim('\r', '\n'); } #if NETCOREAPP