Skip to content

Commit

Permalink
fix Access denied issue on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tareksalem committed Mar 10, 2022
1 parent b835d2e commit 08043cc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/file_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,14 @@ impl FileStore {
.open(&tmp_filename)?;
file.lock_exclusive()?;
tmp_file.lock_exclusive()?;

match Write::write_all(&mut tmp_file, json_string.as_bytes()) {
Err(err) => Err(err),
Ok(_) => {
rename(tmp_filename, file_name)?;
tmp_file.unlock()?;
file.unlock()
file.unlock()?;
drop(file);
drop(tmp_file);
rename(tmp_filename, file_name)
}
}
}
Expand Down

0 comments on commit 08043cc

Please sign in to comment.