Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-volume): sync an installed version through a writable handle on Windows (#6455)

injaneity38d39292a453
diff --git a/libs/cua/crates/cua-volume/src/fs.rs b/libs/cua/crates/cua-volume/src/fs.rs
index c113330e79..a8085e53b3 100644
--- a/libs/cua/crates/cua-volume/src/fs.rs
+++ b/libs/cua/crates/cua-volume/src/fs.rs
@@ -616,7 +616,9 @@ impl FsBackend {
fs::copy(&path, &tmp)?;
let _ = fs::remove_file(&path);
}
- File::open(&tmp)?.sync_all()?;
+ // Opened for writing: Windows refuses FlushFileBuffers on a
+ // read-only handle (Access is denied).
+ OpenOptions::new().write(true).open(&tmp)?.sync_all()?;
fs::rename(&tmp, &dst).inspect_err(|_| {
let _ = fs::remove_file(&tmp);
})?;