Skip to content

fix(rust): handle rustup check exit code 100 as non-error#8832

Merged
jdx merged 4 commits intojdx:mainfrom
shalk:fix/rust-outdated-exit-code-100
Mar 31, 2026
Merged

fix(rust): handle rustup check exit code 100 as non-error#8832
jdx merged 4 commits intojdx:mainfrom
shalk:fix/rust-outdated-exit-code-100

Conversation

@shalk
Copy link
Copy Markdown
Contributor

@shalk shalk commented Mar 31, 2026

Summary

Fixes the issue where mise outdated fails when rust toolchain updates are
available.

Problem

rustup check returns exit code 100 when toolchain updates are available, which
is normal behavior and not an error. Previously, mise treated this as a failure,
causing mise outdated to report:

Error getting outdated info for core:rust@stable: command ["rustup", "check"]
exited with code 100

Solution

Changed the outdated_info method in src/plugins/core/rust.rs to use
.unchecked().run() instead of .read(), allowing mise to manually handle the
exit code and parse the output correctly even when rustup returns 100.

Testing

  • Built successfully with cargo build --release
  • Verified with cargo check
    EOF

`rustup check` returns exit code 100 when toolchain updates are
available, which is normal behavior and not an error. Previously,
mise treated this as a failure, causing `mise outdated` to report:
"Error getting outdated info for core:rust@stable: command
[\"rustup\", \"check\"] exited with code 100"

This change uses `.unchecked().run()` instead of `.read()` to
manually handle the exit code, allowing mise to parse the output
and detect updates correctly even when rustup returns 100.

Fixes the issue where `mise outdated` fails when rust toolchain
updates are available.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the Rust plugin to correctly handle exit code 100 from 'rustup check', which signifies available updates rather than a failure. A review comment suggests refining the error handling because the current use of '.unchecked()' suppresses all non-zero exit codes, potentially hiding genuine errors. It is recommended to explicitly verify that the exit code is either 0 or 100.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 31, 2026

Greptile Summary

This PR fixes mise outdated incorrectly failing for Rust toolchains by treating rustup check's exit code 100 — which simply means an update is available — as a non-error. The previous code used .read(), which propagated every non-zero exit as a hard failure. The new code uses .unchecked().run() with manual exit-code inspection: codes 0 and 100 are both treated as success, while any other code bails with a descriptive error that includes both the exit code and the captured stderr output.

Key changes:

  • Replaced .read() with .stdout_capture().stderr_capture().unchecked().run() in outdated_info
  • Added explicit guard: only exit codes 0 and 100 are accepted; all other codes surface a proper error with the captured stderr message
  • The previous reviewer concern about silently swallowing all non-zero exit codes has been addressed in this revision

Confidence Score: 5/5

Safe to merge — the fix is minimal, correct, and the prior concern about swallowed error codes has been resolved.

The change correctly restricts the non-error treatment to exactly exit codes 0 and 100, bailing with a clear diagnostic for anything else. The previous reviewer concern about silently swallowing all non-zero exit codes was already addressed in this revision. No regressions are apparent and the logic is straightforward.

No files require special attention.

Important Files Changed

Filename Overview
src/plugins/core/rust.rs Refactors outdated_info to use .unchecked().run() with explicit exit code handling so that rustup's exit code 100 (update available) is no longer treated as an error, while all other unexpected codes still propagate correctly.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[outdated_info called] --> B{Is version a semver?}
    B -- Yes --> C[OutdatedInfo::resolve via registry]
    B -- No --> D[Run rustup check unchecked]
    D --> E{Exit code?}
    E -- 0 --> F[Parse stdout for update lines]
    E -- 100 --> F
    E -- other --> G[bail with exit code and stderr]
    F --> H{Line matches target triple and version regex?}
    H -- Yes --> I[Return Some OutdatedInfo]
    H -- No --> J[Return None]
Loading

Reviews (4): Last reviewed commit: "fix(backend): include rustup check stder..." | Re-trigger Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@jdx
Copy link
Copy Markdown
Owner

jdx commented Mar 31, 2026

I think greptile is right that we should include stderr in the error message

@jdx jdx merged commit 537e1bf into jdx:main Mar 31, 2026
34 checks passed
mise-en-dev added a commit that referenced this pull request Apr 1, 2026
### 🚀 Features

- add azd (Azure Developer CLI) to registry by @rajeshkamal5050 in
[#8828](#8828)

### 🐛 Bug Fixes

- **(aqua)** skip registry lookup for linked versions in list_bin_paths
by @nikobockerman in [#8801](#8801)
- **(rust)** handle rustup check exit code 100 as non-error by @shalk in
[#8832](#8832)
- **(task)** resolve bare aliases in monorepo with config_roots by
@nkakouros in [#8819](#8819)
- show usage help when long_about is defined w/o args/flags by
@nkakouros in [#8824](#8824)

### 📚 Documentation

- fix serif font in sidebar and increase heading sizes by @jdx in
[#8831](#8831)
- fix #vscode link in ide integration page by @jedymatt in
[#8833](#8833)
- fix nested Markdown code fences by @muzimuzhi in
[#8835](#8835)

### New Contributors

- @shalk made their first contribution in
[#8832](#8832)
- @jedymatt made their first contribution in
[#8833](#8833)
- @nikobockerman made their first contribution in
[#8801](#8801)
- @rajeshkamal5050 made their first contribution in
[#8828](#8828)

## 📦 Aqua Registry Updates

#### New Packages (2)

- [`gastownhall/beads`](https://github.com/gastownhall/beads)
- [`getdbt.com/dbt-fusion`](https://github.com/getdbt.com/dbt-fusion)

#### Updated Packages (2)

- [`Azure/azure-dev`](https://github.com/Azure/azure-dev)
- [`magefile/mage`](https://github.com/magefile/mage)
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.

2 participants