Skip to content

Commit

Permalink
Be explicit about which binary we failed to find
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Soltis authored and Greg Soltis committed Apr 26, 2024
1 parent 35e3526 commit a4a5b6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions crates/turborepo-repository/src/package_manager/mod.rs
Expand Up @@ -281,8 +281,9 @@ pub enum Error {
MultiplePackageManagers { managers: Vec<String> },
#[error(transparent)]
Semver(#[from] node_semver::SemverError),
#[error(transparent)]
Which(#[from] which::Error),
#[error("{0}: {1}")]
// this will be something like "cannot find binary: <thing we tried to find>"
Which(which::Error, String),
#[error("invalid utf8: {0}")]
Utf8Error(#[from] std::string::FromUtf8Error),
#[error(transparent)]
Expand Down Expand Up @@ -525,7 +526,8 @@ impl PackageManager {
let lockfile_path = self.lockfile_path(root_path);
let contents = match self {
PackageManager::Bun => {
Command::new(which("bun")?)
let binary = "bun";
Command::new(which(&binary).map_err(|e| Error::Which(e, binary.to_string()))?)

Check failure on line 530 in crates/turborepo-repository/src/package_manager/mod.rs

View workflow job for this annotation

GitHub Actions / Turborepo rust clippy

the borrowed expression implements the required traits
.arg(lockfile_path.to_string())
.current_dir(root_path.to_string())
.output()?
Expand Down
3 changes: 2 additions & 1 deletion crates/turborepo-repository/src/package_manager/yarn.rs
Expand Up @@ -37,7 +37,8 @@ impl<'a> YarnDetector<'a> {
return Ok(version.clone());
}

let yarn_binary = which("yarn")?;
let binary = "yarn";
let yarn_binary = which(&binary).map_err(|e| Error::Which(e, binary.to_string()))?;

Check failure on line 41 in crates/turborepo-repository/src/package_manager/yarn.rs

View workflow job for this annotation

GitHub Actions / Turborepo rust clippy

the borrowed expression implements the required traits
let output = Command::new(yarn_binary)
.arg("--version")
.current_dir(self.repo_root)
Expand Down

0 comments on commit a4a5b6b

Please sign in to comment.