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.
This commit is contained in:
@@ -248,7 +248,8 @@ public static class Program {
|
|||||||
e.ToString().EscapeMarkup()));
|
e.ToString().EscapeMarkup()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
string processError = "";
|
||||||
var exitCode = AnsiConsole.Status()
|
var exitCode = AnsiConsole.Status()
|
||||||
.Spinner(Spinner.Known.Dots)
|
.Spinner(Spinner.Known.Dots)
|
||||||
.Start<int>("Creating package with 'dotnet pack' ", ctx => {
|
.Start<int>("Creating package with 'dotnet pack' ", ctx => {
|
||||||
@@ -261,10 +262,12 @@ public static class Program {
|
|||||||
RedirectStandardError = !Verbose
|
RedirectStandardError = !Verbose
|
||||||
});
|
});
|
||||||
p?.WaitForExit();
|
p?.WaitForExit();
|
||||||
|
processError = p?.StandardError?.ReadToEnd() ?? "";
|
||||||
return p?.ExitCode ?? -1;
|
return p?.ExitCode ?? -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
|
ShowError(processError.EscapeMarkup());
|
||||||
ShowError(Exceptions.dotnet_pack_failure.EscapeMarkup(), exitCode);
|
ShowError(Exceptions.dotnet_pack_failure.EscapeMarkup(), exitCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -420,7 +423,9 @@ public static class Program {
|
|||||||
task.Increment(size / 2);
|
task.Increment(size / 2);
|
||||||
if (p != null)
|
if (p != null)
|
||||||
await p.WaitForExitAsync(ct);
|
await p.WaitForExitAsync(ct);
|
||||||
|
processError += p?.StandardError?.ReadToEnd() ?? "";
|
||||||
if (p?.ExitCode != 0) {
|
if (p?.ExitCode != 0) {
|
||||||
|
ShowError(processError.EscapeMarkup());
|
||||||
ShowError(Exceptions.dotnet_nuget_push_failure, p.ExitCode);
|
ShowError(Exceptions.dotnet_nuget_push_failure, p.ExitCode);
|
||||||
}
|
}
|
||||||
task.Increment(size / 2);
|
task.Increment(size / 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user