Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,17 +508,39 @@ fn resolve_program(name: &str, vars: &HashMap<String, String>) -> Result<PathBuf

for dir in env::split_paths(&paths) {
let candidate = dir.join(name);
if candidate.is_file() {
return Ok(candidate);
}
if !has_ext {
for ext in &exts {
let candidate = dir.join(format!("{name}{ext}"));

#[cfg(windows)]
{
if has_ext && candidate.is_file() {
return Ok(candidate);
}
if !has_ext {
for ext in &exts {
let candidate = dir.join(format!("{name}{ext}"));
if candidate.is_file() {
return Ok(candidate);
}
}
if candidate.is_file() {
return Ok(candidate);
}
}
}

#[cfg(not(windows))]
{
if candidate.is_file() {
return Ok(candidate);
}
if !has_ext {
for ext in &exts {
let candidate = dir.join(format!("{name}{ext}"));
if candidate.is_file() {
return Ok(candidate);
}
}
}
}
}

bail!("{name}: command not found")
Expand Down
Loading