Skip to content

Commit

Permalink
fix(env_tool): return None if env is empty
Browse files Browse the repository at this point in the history
Signed-off-by: DragonBillow <[email protected]>
  • Loading branch information
cathaysia committed Apr 2, 2024
1 parent be62f4a commit 1e5e295
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2948,16 +2948,17 @@ impl Build {
/// Returns compiler path, optional modifier name from whitelist, and arguments vec
fn env_tool(&self, name: &str) -> Option<(PathBuf, Option<String>, Vec<String>)> {
let tool = match self.getenv_with_target_prefixes(name) {
Ok(tool) => tool,
Err(_) => return None,
Ok(tool) if !tool.trim().is_empty() => tool,
_ => return None,
};
let tool = tool.trim();

// If this is an exact path on the filesystem we don't want to do any
// interpretation at all, just pass it on through. This'll hopefully get
// us to support spaces-in-paths.
if Path::new(&*tool).exists() {
if Path::new(tool).exists() {
return Some((
PathBuf::from(&*tool),
PathBuf::from(tool),
Self::rustc_wrapper_fallback(),
Vec::new(),
));
Expand Down

0 comments on commit 1e5e295

Please sign in to comment.