Skip to content

fix: resolve rustup from HOME when not in PATH - #99

Merged
GregoryConrad merged 2 commits into
GregoryConrad:mainfrom
agg23:fix/PATH-lookup-rustup
Aug 19, 2026
Merged

fix: resolve rustup from HOME when not in PATH#99
GregoryConrad merged 2 commits into
GregoryConrad:mainfrom
agg23:fix/PATH-lookup-rustup

Conversation

@agg23

@agg23 agg23 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #95

I couldn't come up with a nice way to test this due to how Dart restricts environment mutation for tests. If you want me to add tests, let me know.

Comment thread native_toolchain_rust/lib/src/process_runner.dart
environment: environment,
);
} on ProcessException catch (e) {
lastException = e;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can we differentiate on when it was an executable not found error vs some other error? That’d be better than just blindly using the last exception seen

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure. I hesitated with this, but ultimately decided I wasn't sure what would be the more valuable error. Generally I think you'd want to see that PATH rustup was not found, but that's not necessarily always true.

What do you think this should look like?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I was envisioning an edge case where normal rustup failed to run via network issue or something of the like, and then later on we run into an “executable not found” and then the last encountered error is a red herring.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

So ideally, the actual error (if there was one), followed by the binary not found error as a last resort

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think that scenario can occur. The only time we will see a ProcessException is when we can't find the process or something of that caliber. Any other types of errors would have a non-zero exit code, thus creating a RustProcessException and ignoring our catch statement (as it was before my change)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

ahh yea, missed that

Comment thread native_toolchain_rust/lib/src/process_runner.dart
@GregoryConrad

Copy link
Copy Markdown
Owner

Thanks for the PR. For a change like this probably fine to skip tests as long as it was working for you

@GregoryConrad
GregoryConrad force-pushed the fix/PATH-lookup-rustup branch from 67f48ce to ec24880 Compare August 19, 2026 01:07
@GregoryConrad
GregoryConrad enabled auto-merge (squash) August 19, 2026 01:14
@GregoryConrad
GregoryConrad merged commit 0be0e92 into GregoryConrad:main Aug 19, 2026
4 of 6 checks passed
@adil192

adil192 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

I couldn't come up with a nice way to test this due to how Dart restricts environment mutation for tests.

That particular problem may be solved in the future with dart-lang/native#3545

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.

rustup detection in common environments on macOS

3 participants