From 093da5d0f3b8d88702e8bcda48b170cc18b85718 Mon Sep 17 00:00:00 2001 From: qwsdcvghyu89 <61093706+qwsdcvghyu89@users.noreply.github.com> Date: Sat, 27 Sep 2025 16:15:30 +1000 Subject: [PATCH] Improve error reporting for process failures Captures and displays standard error output when 'dotnet pack' or 'dotnet nuget push' commands fail, providing more detailed error information to the user. --- aeqw89.tools.Publish/Program.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aeqw89.tools.Publish/Program.cs b/aeqw89.tools.Publish/Program.cs index 850cd02..9a30d17 100644 --- a/aeqw89.tools.Publish/Program.cs +++ b/aeqw89.tools.Publish/Program.cs @@ -248,7 +248,8 @@ public static class Program { e.ToString().EscapeMarkup())); } }; - + + string processError = ""; var exitCode = AnsiConsole.Status() .Spinner(Spinner.Known.Dots) .Start("Creating package with 'dotnet pack' ", ctx => { @@ -261,10 +262,12 @@ public static class Program { RedirectStandardError = !Verbose }); p?.WaitForExit(); + processError = p?.StandardError?.ReadToEnd() ?? ""; return p?.ExitCode ?? -1; }); if (exitCode != 0) { + ShowError(processError.EscapeMarkup()); ShowError(Exceptions.dotnet_pack_failure.EscapeMarkup(), exitCode); return; } @@ -420,7 +423,9 @@ public static class Program { task.Increment(size / 2); if (p != null) await p.WaitForExitAsync(ct); + processError += p?.StandardError?.ReadToEnd() ?? ""; if (p?.ExitCode != 0) { + ShowError(processError.EscapeMarkup()); ShowError(Exceptions.dotnet_nuget_push_failure, p.ExitCode); } task.Increment(size / 2);