Skip to content

Commit d902ed3

Browse files
authored
fix(env_tool): return None if env is empty (#1021)
1 parent fd912ec commit d902ed3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,16 +2963,17 @@ impl Build {
29632963
/// Returns compiler path, optional modifier name from whitelist, and arguments vec
29642964
fn env_tool(&self, name: &str) -> Option<(PathBuf, Option<String>, Vec<String>)> {
29652965
let tool = match self.getenv_with_target_prefixes(name) {
2966-
Ok(tool) => tool,
2967-
Err(_) => return None,
2966+
Ok(tool) if !tool.trim().is_empty() => tool,
2967+
_ => return None,
29682968
};
2969+
let tool = tool.trim();
29692970

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

0 commit comments

Comments
 (0)