-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When process returns non-zero exit code, it's not possible to get output. #103
Comments
@Erwinvandervalk thanks for raising this. There are a few things to consider here:
Another thing to consider is the exit code of |
BTW - if the process exit code is currently not meaningful, it could be worth raising an issue with NuGet to change that. It would be much simpler to inspect the exit code than to tinker with stdout/stderr, and it would require no changes in SimpleExec. |
Totally agree with your comment that the exit code should convey what kind of problem there is. I will dig into dotnet nuget a bit more to see if they return a specific error code, but I doubt it. But from the perspective of SimpleExec library, I do think it's valuable to have access to the stdout and stderr. Parsing output is a often horrible solution (some machines might have different language settings for example), but sometimes you don't have much of a choice to get a use case to work. Will follow up with a suggestion :) |
I guess it won't hurt to set the stdout received so far as a property on the exception. However, I'm not sure that will help you. If |
@Erwinvandervalk did you get anywhere regarding getting a specific exit code from |
It doesn't look like nuget.exe does that unfortunately. I dived into the source code of nuget.exe. It doesn't appear to use any exit code other than 1 for failures. https://github.com/NuGet/NuGet.Client/search?q=ExitCodeException&unscoped_q=ExitCodeException |
@Erwinvandervalk I suggest that you propose this change to the NuGet team. If you raise an issue, I'd be more than happy to chime in with some supporting comments. |
Created an issue here: NuGet/Home#7723 |
👍 @Erwinvandervalk you've captured the problem nicely in that issue. FWIW, I think NuGet/Home#1630 is also a good, perhaps better, solution. |
Hey @Erwinvandervalk, seeing as the best fix we've identified lies in NuGet, I'm closing this. Thanks again for raising the question. |
@Erwinvandervalk good and bad news! The good news is that NuGet/Home#1630 was released in NuGet 5.1. The bad news is that, while NuGet 5.1 is stated as being included in .NET SDK 2.1.70x and 2.2.30x, |
FTR NuGet/Home#1630 was propagated to the .NET SDK in at least version 3.1.200. |
@Erwinvandervalk FYI in the new API in version 9 both standard output and standard error are available on |
When executing a dotnet nuget publish, I get a 409 status if the package already exists. I'm trying to get the output, but this is only returned when the process returns a 0 status code. It could be a handy property on the non zero statuscode exception.
Something like:
If you want, I can create a PR that adds this.
The text was updated successfully, but these errors were encountered: