diff --git a/Cargo.lock b/Cargo.lock index 28e99a63a645f..97f40f4282b38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7070,6 +7070,7 @@ dependencies = [ "build-target", "clap 4.0.29", "clap_complete", + "dunce", "itertools", "predicates", "pretty_assertions", diff --git a/crates/turborepo-lib/src/shim.rs b/crates/turborepo-lib/src/shim.rs index 4605c6139b740..e91d1c23b6490 100644 --- a/crates/turborepo-lib/src/shim.rs +++ b/crates/turborepo-lib/src/shim.rs @@ -1,5 +1,3 @@ -#[cfg(not(windows))] -use std::fs::canonicalize as fs_canonicalize; use std::{ env, env::current_dir, @@ -13,7 +11,6 @@ use std::{ use anyhow::{anyhow, Result}; use chrono::offset::Local; -#[cfg(windows)] use dunce::canonicalize as fs_canonicalize; use env_logger::{fmt::Color, Builder, Env, WriteStyle}; use log::{debug, Level, LevelFilter}; diff --git a/crates/turborepo/Cargo.toml b/crates/turborepo/Cargo.toml index c9bd081e123dd..89e8ca3a7ad7f 100644 --- a/crates/turborepo/Cargo.toml +++ b/crates/turborepo/Cargo.toml @@ -17,6 +17,7 @@ pretty_assertions = "1.3.0" anyhow = { version = "1.0.65", features = ["backtrace"] } clap = { version = "4.0.22", features = ["derive"] } clap_complete = "4.0.6" +dunce = "1.0" predicates = "2.1.1" serde = { version = "1.0.145", features = ["derive"] } serde_json = "1.0.86" diff --git a/crates/turborepo/src/main.rs b/crates/turborepo/src/main.rs index ab599f96f0535..bd20fe4a731e7 100644 --- a/crates/turborepo/src/main.rs +++ b/crates/turborepo/src/main.rs @@ -1,10 +1,12 @@ use std::{env::current_exe, process, process::Stdio}; use anyhow::Result; +use dunce::canonicalize as fs_canonicalize; use turborepo_lib::{Args, Payload}; fn run_go_binary(args: Args) -> Result { - let mut go_binary_path = current_exe()?; + // canonicalize the binary path to ensure we can find go-turbo + let mut go_binary_path = fs_canonicalize(current_exe()?)?; go_binary_path.pop(); #[cfg(windows)] go_binary_path.push("go-turbo.exe");