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 6f616d1
Showing 1 changed file with 5 additions and 3 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()))?)
.arg(lockfile_path.to_string())
.current_dir(root_path.to_string())
.output()?
Expand Down

0 comments on commit 6f616d1

Please sign in to comment.