Skip to content
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

Expose ExitCode on ProcessException #1068

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

Baune8D
Copy link
Contributor

@Baune8D Baune8D commented Dec 2, 2022

  • Expose the exit code on ProcessException.

It would be immensly useful to be able to get the actual exit code instead of parsing the error message.

I confirm that the pull-request:

  • Follows the contribution guidelines
  • Is based on my own work
  • Is in compliance with my employer

@ron-myers
Copy link

Good work @Baune8D - I have wanted this a few times in the past.

@matkoch matkoch merged commit 3555564 into nuke-build:develop Dec 12, 2022
@matkoch matkoch added this to the v6.2.2 milestone Dec 12, 2022
@matkoch matkoch linked an issue Dec 12, 2022 that may be closed by this pull request
matkoch pushed a commit that referenced this pull request Dec 12, 2022
matkoch pushed a commit that referenced this pull request Dec 12, 2022
@matkoch
Copy link
Member

matkoch commented May 4, 2023

Next version is going to have this

DotNetRestore(_ => _
    .SetProjectFile(Solution)
    .DisableProcessAssertZeroExitCode());

DotNetRestore(_ => _
    .SetProjectFile(Solution)
    .SetProcessCustomExitHandler((_, p) =>
        p.ExitCode switch
        {
            0 => null,
            _ => throw new Exception()
        }));

DotNetRestore(_ => _
    .SetProjectFile(Solution + "aaaa")
    .SetProcessCustomExitHandler(p =>
    {
        switch (p.ExitCode)
        {
            case 1:
                break;
        }
    }));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make available exit code of failed process (ProcessException.Process)
3 participants