nebu-ctx 0.5.9

Lean-ctx runtime adapted for the NebuCtx Cloud-backed product.
Documentation
pub fn resolve_portable_binary() -> String {
    let which_cmd = if cfg!(windows) { "where" } else { "which" };
    if let Ok(output) = std::process::Command::new(which_cmd)
        .arg("nebu-ctx")
        .stderr(std::process::Stdio::null())
        .output()
    {
        if output.status.success() {
            let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
            if !path.is_empty() {
                return sanitize_exe_path(path);
            }
        }
    }
    let path = std::env::current_exe()
        .map(|p| p.to_string_lossy().to_string())
        .unwrap_or_else(|_| "nebu-ctx".to_string());
    sanitize_exe_path(path)
}

fn sanitize_exe_path(path: String) -> String {
    path.trim_end_matches(" (deleted)").to_string()
}