Skip to content

Commit 9b1328a

Browse files
authored
Lock during installs in uv format to prevent races (#15551)
Closes #15513
1 parent 0bde9e4 commit 9b1328a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • crates/uv-bin-install/src

crates/uv-bin-install/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ pub async fn bin_install(
165165
) -> Result<PathBuf, Error> {
166166
let platform = Platform::from_env()?;
167167
let platform_name = platform.as_cargo_dist_triple();
168-
169-
// Check the cache first
170168
let cache_entry = CacheEntry::new(
171169
cache
172170
.bucket(CacheBucket::Binaries)
@@ -176,6 +174,8 @@ pub async fn bin_install(
176174
binary.executable(),
177175
);
178176

177+
// Lock the directory to prevent racing installs
178+
let _lock = cache_entry.with_file(".lock").lock().await?;
179179
if cache_entry.path().exists() {
180180
return Ok(cache_entry.into_path_buf());
181181
}

0 commit comments

Comments
 (0)