feat(cli): add --check flag to rustup update for semantic exit codes - #4992
Closed
gkamathe wants to merge 1 commit into
Closed
feat(cli): add --check flag to rustup update for semantic exit codes#4992gkamathe wants to merge 1 commit into
gkamathe wants to merge 1 commit into
Conversation
When --check is passed, rustup update returns exit code 100 if any of the requested toolchains were updated, and 0 if everything was already up to date. Without --check, behavior is unchanged. Closes rust-lang#4987
Member
|
Hello! I have reasons to believe that this PR is low-effort and has violated our contributing guidelines (LLM usage is explicitly banned for rustup/doc/dev-guide/src/index.md Lines 64 to 70 in 60ae6e6 As such, I'm closing it now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds a
--checkflag torustup updatethat causes the command to set its exit code based on whether any toolchains were actually updated:0— no updates were applied; everything was already up to date100— at least one toolchain was updated1— an error occurredWithout
--check, the behavior is unchanged (exit 0 on success regardless of whether updates occurred). This preserves backward compatibility for existing workflows.The exit codes align with
rustup check(#4681).Closes #4987
Changes
--checkflag to therustup updatesubcommandupdate()to track whether any toolchain'sUpdateStatuswasInstalledorUpdated, and returnExitCode::UPDATES_AVAILABLE(100)when
--checkis set and updates occurredupdate_all_channels()to return whether any channel was updatedalongside the existing exit code
update_help()inhelp.rs(exit 100), without --check (always exit 0), and all-channels update
Test plan
cargo fmt --all --checkpassescargo clippy --all-targets --all-features -- -D warningspassescargo test --features=testpassesupdate_check_no_updates,update_check_with_updates,update_without_check_always_succeeds, andupdate_check_all_channelsall pass