homeboy 0.63.0

CLI for multi-component deployment and development workflow automation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Resolve the `homeboy` binary via $PATH, returning the first match that
/// exists on disk. This avoids the stale `/proc/self/exe` problem on Linux
/// where the old inode is deleted after the upgrade replaces the binary.
pub(crate) fn resolve_binary_on_path() -> Option<std::path::PathBuf> {
    let path_var = std::env::var("PATH").ok()?;
    resolve_binary_on_path_var(&path_var)
}

pub(crate) fn resolve_binary_on_path_var(path_var: &str) -> Option<std::path::PathBuf> {
    for dir in path_var.split(':') {
        let candidate = std::path::PathBuf::from(dir).join("homeboy");
        if candidate.exists() {
            return Some(candidate);
        }
    }
    None
}