Skip to content

Commit

Permalink
fix: use File::sync_all API for closing registry file
Browse files Browse the repository at this point in the history
  • Loading branch information
paolobarbolini committed Apr 6, 2024
1 parent 4725e06 commit 640ec2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/registry.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
fs::{self, File},
io::{self, Write as _},
io,
path::{Path, PathBuf},
};

Expand Down Expand Up @@ -39,7 +39,7 @@ impl RegistryCrate {

let mut tmp_crate_file = File::create(&tmp_crate_path)?;
io::copy(&mut resp, &mut tmp_crate_file)?;
tmp_crate_file.flush()?;
tmp_crate_file.sync_all()?;
drop(tmp_crate_file);

fs::rename(tmp_crate_path, &crate_path)?;
Expand Down

0 comments on commit 640ec2a

Please sign in to comment.