Skip to content
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

Allow missing AR/CC/etc tools for precompiled rubies #394

Merged
merged 3 commits into from
Jul 1, 2024
Merged

Conversation

ianks
Copy link
Collaborator

@ianks ianks commented Jul 1, 2024

Sometimes the AR setup in rbconfig.rb can incorrect in the case of precompiled binaries. This PR makes us resistant to that.

@@ -270,7 +273,13 @@ fn get_tool(env_var: &str, default: &str) -> Command {
let mut tool_args = shellsplit(tool_args).into_iter();
let tool = tool_args.next().unwrap_or_else(|| default.to_string());

let mut cmd = new_command(&tool);
let mut cmd = if !Path::new(&tool).is_file() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the fix

Copy link

Choose a reason for hiding this comment

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

imho I prefer to avoid negation in conditionals if possible, so instead I would go with

let mut cmd = if Path::new(&tool).is_file() { 
    new_command(&tool)
} else {
    debug_log!("[WARN] {tool} tool not found, falling back to {default}");
    new_command(default)
}

feels easier to read/undertsand, but just an opinion xD

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!

Copy link

@driv3r driv3r left a comment

Choose a reason for hiding this comment

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

Looks legit

@@ -270,7 +273,13 @@ fn get_tool(env_var: &str, default: &str) -> Command {
let mut tool_args = shellsplit(tool_args).into_iter();
let tool = tool_args.next().unwrap_or_else(|| default.to_string());

let mut cmd = new_command(&tool);
let mut cmd = if !Path::new(&tool).is_file() {
Copy link

Choose a reason for hiding this comment

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

imho I prefer to avoid negation in conditionals if possible, so instead I would go with

let mut cmd = if Path::new(&tool).is_file() { 
    new_command(&tool)
} else {
    debug_log!("[WARN] {tool} tool not found, falling back to {default}");
    new_command(default)
}

feels easier to read/undertsand, but just an opinion xD

@ianks
Copy link
Collaborator Author

ianks commented Jul 1, 2024

The CI failures seems GHA related, so I'm going to merge with them failing for now.

@ianks ianks merged commit 95cf25c into main Jul 1, 2024
61 of 65 checks passed
@ianks ianks deleted the precompiled-rubies branch July 1, 2024 18:41
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