Skip to content

fix(rustup-mode): return ExitCode(1) when update() fails - #3952

Merged
rami3l merged 3 commits into
rust-lang:masterfrom
rami3l:fix/weird-exit-code
Jul 16, 2024
Merged

fix(rustup-mode): return ExitCode(1) when update() fails#3952
rami3l merged 3 commits into
rust-lang:masterfrom
rami3l:fix/weird-exit-code

Conversation

@rami3l

Copy link
Copy Markdown
Member

Closes#3476, verified via local testing.

@rami3l
rami3l requested a review from djcJuly 16, 2024 11:55
Comment threadsrc/cli/rustup_mode.rs Outdated
djc
djc approved these changes Jul 16, 2024

@djcdjc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems okay. Personally I feel like use of the custom ExitCode is a bad abstraction. One idea I've played with is that we should change types to be Result<T, Option<E>>, where the Some represents an error that should be yielded by the top-level caller while None means the error has already been reported. (We then report ExitCode::FAILURE if the Result is Err.)

Comment threadsrc/utils/utils.rs Outdated
@rami3l

rami3l commented Jul 16, 2024

Copy link
Copy Markdown
MemberAuthor

This seems okay. Personally I feel like use of the custom ExitCode is a bad abstraction. One idea I've played with is that we should change types to be Result<T, Option<E>>, where the Some represents an error that should be yielded by the top-level caller while None means the error has already been reported. (We then report ExitCode::FAILURE if the Result is Err.)

@djc Indeed, in other projects that I've worked with my principle is that we should never expose the exit code with the single exception of the main module, where some thiserror is converted to ExitStatus via an impl Termination.

But that kind of change is clearly out of the scope of this PR...

@rami3l
rami3lforce-pushed the fix/weird-exit-code branch 3 times, most recently from 5d54796 to cecc7e0CompareJuly 16, 2024 12:33
@rami3l
rami3l requested a review from djcJuly 16, 2024 12:38
djc
djc approved these changes Jul 16, 2024
Comment threadsrc/utils/utils.rs
@rami3l
rami3lforce-pushed the fix/weird-exit-code branch from cecc7e0 to ad271f1CompareJuly 16, 2024 13:08
@rami3l
rami3l enabled auto-merge July 16, 2024 13:11
@rami3l
rami3l added this pull request to the merge queue Jul 16, 2024
Merged via the queue into rust-lang:master with commit 3fa1790Jul 16, 2024
@rami3l
rami3l deleted the fix/weird-exit-code branch July 16, 2024 13:46
@rami3lrami3l modified the milestone: 1.28.0Jul 17, 2024
@rami3lrami3l mentioned this pull request Oct 6, 2024
3 tasks
Sign up for freeto 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.

When rustup update fails, it doesn't return an exit code that indicate failure

2 participants

@rami3l@djc