diff --git a/Cargo.lock b/Cargo.lock index 52da9ff32..ae9d4d7d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2643,6 +2643,7 @@ dependencies = [ "puffin-fs", "regex", "rmp-serde", + "same-file", "serde", "serde_json", "tempfile", diff --git a/Cargo.toml b/Cargo.toml index adf3b40d6..7259a39ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,6 +68,7 @@ reqwest-middleware = { version = "0.2.4" } reqwest-retry = { version = "0.3.0" } rmp-serde = { version = "1.1.2" } rustc-hash = { version = "1.1.0" } +same-file = { version = "1.0.6" } seahash = { version = "4.1.0" } serde = { version = "1.0.194" } serde_json = { version = "1.0.111" } diff --git a/crates/puffin-interpreter/Cargo.toml b/crates/puffin-interpreter/Cargo.toml index a03ebe299..563881e99 100644 --- a/crates/puffin-interpreter/Cargo.toml +++ b/crates/puffin-interpreter/Cargo.toml @@ -25,6 +25,7 @@ fs-err = { workspace = true, features = ["tokio"] } once_cell = { workspace = true } regex = { workspace = true } rmp-serde = { workspace = true } +same-file = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } thiserror = { workspace = true } diff --git a/crates/puffin-interpreter/src/interpreter.rs b/crates/puffin-interpreter/src/interpreter.rs index 9ecc661d1..c6c46292e 100644 --- a/crates/puffin-interpreter/src/interpreter.rs +++ b/crates/puffin-interpreter/src/interpreter.rs @@ -392,7 +392,7 @@ impl InterpreterQueryResult { // If `executable` is a pyenv shim, a bash script that redirects to the activated // python executable at another path, we're not allowed to cache the interpreter info. - if executable == info.sys_executable { + if same_file::is_same_file(executable, &info.sys_executable).unwrap_or(false) { fs::create_dir_all(cache_entry.dir())?; write_atomic_sync( cache_entry.path(),