Wrap returned file on Windows.

This commit is contained in:
Martin Hoffmann
2023-12-14 13:16:28 +01:00
parent 1300b3d2ea
commit 99f672e51c
+6 -4
View File
@@ -48,10 +48,12 @@ impl ExclusiveFile {
fn _open(path: &Path) -> Result<Self, io::Error> {
use std::os::windows::fs::OpenOptionsExt;
OpenOptions::new()
.read(true).write(true).create(true)
.share_mode(0) // 0 means: dont share with other processes.
.open(path)
Ok(Self {
file: OpenOptions::new()
.read(true).write(true).create(true)
.share_mode(0) // 0 means: dont share with other processes.
.open(path)?
})
}
#[cfg(not(windows))]