Skip to content

Commit

Permalink
Make entrypoint writes atomic to avoid overwriting symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jul 17, 2024
1 parent f74235b commit fbf8c1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/install-wheel-rs/src/wheel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,8 @@ pub(crate) fn write_file_recorded(
relative_path.display()
);

File::create(site_packages.join(relative_path))?.write_all(content.as_ref())?;
uv_fs::write_atomic_sync(site_packages.join(relative_path), content.as_ref())?;

let hash = Sha256::new().chain_update(content.as_ref()).finalize();
let encoded_hash = format!("sha256={}", BASE64URL_NOPAD.encode(&hash));
record.push(RecordEntry {
Expand Down

0 comments on commit fbf8c1d

Please sign in to comment.