Skip to content

driver: Improve check for rustc arg #3130

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

Closed
wants to merge 1 commit into from
Closed

driver: Improve check for rustc arg #3130

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 5, 2018

The rustc arg might not be exactly "rustc". It may be any path to a rustc
executable (especially if the RUSTC environment variable is set when
executing cargo). Rather check that it ends in rustc or rust.exe.

The rustc arg might not be exactly "rustc". It may be any path to a rustc
executable (especially if the RUSTC environment variable is set when
executing cargo). Rather check that it ends in `rustc` or `rust.exe`.
@@ -47,7 +47,7 @@ pub fn main() {
if orig_args.len() <= 1 {
std::process::exit(1);
}
if orig_args[1] == "rustc" {
if orig_args[1].ends_with("rustc") || orig_args[1].ends_with("rustc.exe") {
Copy link
Contributor

Choose a reason for hiding this comment

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

you could convert it to a Path and check the file_stem for equality to "rustc"

Copy link
Author

Choose a reason for hiding this comment

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

This is a great idea. I'll submit a new PR.

@ghost ghost closed this Sep 6, 2018
@ghost ghost deleted the driver-rustc-arg branch September 6, 2018 05:12
@ghost ghost mentioned this pull request Sep 6, 2018
This pull request was closed.
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.

1 participant