Skip to content

Commit 273f95c

Browse files
author
Pavel Madaj
committed
in touch open file in write mode
on Windows this is necessary to modify times of a file
1 parent 81f60e4 commit 273f95c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

collector/src/utils/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> anyhow::Result<
4545

4646
/// Touch a file, resetting its modification time.
4747
pub fn touch(path: &Path) -> anyhow::Result<()> {
48-
let file = File::options().read(true).open(path)?;
48+
let file = File::options().read(true).write(true).open(path)?;
4949
file.set_modified(SystemTime::now())
5050
.with_context(|| format!("touching file {:?}", path))?;
5151

0 commit comments

Comments
 (0)