Skip to content

Commit

Permalink
Return appropriate error if path list defined and empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaeroxe committed Oct 17, 2023
1 parent 70d2d1c commit e776ff0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ impl Finder {
}
_ => {
// Search binary in PATHs(defined in environment variable).
let p = paths.ok_or(Error::CannotGetCurrentDirAndPathListEmpty)?;
let paths: Vec<_> = env::split_paths(&p).collect();
let paths =
env::split_paths(&paths.ok_or(Error::CannotGetCurrentDirAndPathListEmpty)?)
.collect::<Vec<_>>();
if paths.is_empty() {
return Err(Error::CannotGetCurrentDirAndPathListEmpty);
}

Either::Right(Self::path_search_candidates(path, paths).into_iter())
}
Expand Down

0 comments on commit e776ff0

Please sign in to comment.