Skip to content

Commit e35dca3

Browse files
committed
do not fail on check for tool presence
package managers may not have any version of the desired tool installed
1 parent 397bf24 commit e35dca3

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

  • clang-tools-manager/src/downloader/native_packages

clang-tools-manager/src/downloader/native_packages/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ pub async fn try_install_package(
8383
for mgr in os_pkg_managers {
8484
log::info!("Trying to install {tool} v{min_version} using {mgr} package manager.");
8585
let pkg_name = mgr.get_package_name(tool);
86-
if mgr.is_installed_package(&pkg_name, Some(min_version)) {
87-
let path =
88-
tool.get_exe_path(&RequestedVersion::Requirement(version_req.clone()))?;
89-
let version = tool.capture_version(&path)?;
90-
if version_req.matches(&version) {
91-
log::info!(
92-
"Found {tool} version matching {version_req} installed via {mgr} package manager."
93-
);
94-
return Ok(Some(ClangVersion { version, path }));
95-
}
86+
if mgr.is_installed_package(&pkg_name, Some(min_version))
87+
&& let Ok(path) =
88+
tool.get_exe_path(&RequestedVersion::Requirement(version_req.clone()))
89+
&& let Ok(version) = tool.capture_version(&path)
90+
&& version_req.matches(&version)
91+
{
92+
log::info!(
93+
"Found {tool} version matching {version_req} installed via {mgr} package manager."
94+
);
95+
return Ok(Some(ClangVersion { version, path }));
9696
} else {
9797
log::info!(
9898
"{mgr} package manager does not have a version of {tool} matching {version_req} installed."

0 commit comments

Comments
 (0)