fix: add missing awaits

This commit is contained in:
daimond113 2024-11-05 21:02:23 +01:00
parent b7444566dd
commit ab9124e02c
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C

View file

@ -39,13 +39,13 @@ pub enum PackageFS {
Copy(PathBuf, TargetKind), Copy(PathBuf, TargetKind),
} }
fn make_readonly(_file: &fs::File) -> std::io::Result<()> { async fn make_readonly(_file: &fs::File) -> std::io::Result<()> {
// on Windows, file deletion is disallowed if the file is read-only which breaks patching // on Windows, file deletion is disallowed if the file is read-only which breaks patching
#[cfg(not(windows))] #[cfg(not(windows))]
{ {
let mut permissions = _file.metadata()?.permissions(); let mut permissions = _file.metadata().await?.permissions();
permissions.set_readonly(true); permissions.set_readonly(true);
_file.set_permissions(permissions) _file.set_permissions(permissions).await
} }
#[cfg(windows)] #[cfg(windows)]
@ -99,7 +99,7 @@ pub(crate) async fn store_in_cas<
match temp_path.persist_noclobber(&cas_path) { match temp_path.persist_noclobber(&cas_path) {
Ok(_) => { Ok(_) => {
make_readonly(&file_writer.into_inner())?; make_readonly(&file_writer.into_inner()).await?;
} }
Err(e) if e.error.kind() == std::io::ErrorKind::AlreadyExists => {} Err(e) if e.error.kind() == std::io::ErrorKind::AlreadyExists => {}
Err(e) => return Err(e.error), Err(e) => return Err(e.error),
@ -138,10 +138,10 @@ impl PackageFS {
#[cfg(unix)] #[cfg(unix)]
{ {
let mut permissions = f.metadata()?.permissions(); let mut permissions = f.metadata().await?.permissions();
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
permissions.set_mode(permissions.mode() | 0o644); permissions.set_mode(permissions.mode() | 0o644);
f.set_permissions(permissions)?; f.set_permissions(permissions).await?;
} }
} }
} }