/// Find a binary in the host PATH
Find a binary in the host PATH
Find a binary in the host PATH
pub fn find_binary(binary: &str) -> Option<PathBuf> {
    std::env::var_os("PATH").and_then(|paths| {
        std::env::split_paths(&paths)
            .filter_map(|dir| {
                let full_path = dir.join(binary);
                if full_path.is_file() {
                    Some(full_path)
                } else {
                    None
                }
            })
            .next()
    })
}
pub fn find_binary ( binary : & str ) -> Option < PathBuf > { std :: env :: var_os ( " " ) . and_then ( | paths | { std :: env :: split_paths ( & paths ) . filter_map ( | dir | { let full_path = dir . join ( binary ) ; if full_path . is_file ( ) { Some ( full_path ) } else { None } } ) . next ( ) } ) }
Find a binary in the host PATH
Find a binary in the host PATH
binary
&str