Skip to content

Commit

Permalink
bootstrap: fix trying to modify file times on read-only file
Browse files Browse the repository at this point in the history
  • Loading branch information
jieyouxu committed Aug 11, 2024
1 parent 5e5ec8a commit 01a97ed
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1777,9 +1777,8 @@ Executed at: {executed_at}"#,
}
}
if let Ok(()) = fs::hard_link(&src, dst) {
// Attempt to "easy copy" by creating a hard link
// (symlinks don't work on windows), but if that fails
// just fall back to a slow `copy` operation.
// Attempt to "easy copy" by creating a hard link (symlinks are priviledged on windows),
// but if that fails just fall back to a slow `copy` operation.
} else {
if let Err(e) = fs::copy(&src, dst) {
panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)
Expand All @@ -1790,7 +1789,7 @@ Executed at: {executed_at}"#,
.set_accessed(t!(metadata.accessed()))
.set_modified(t!(metadata.modified()));

let dst_file = t!(fs::File::open(dst));
let dst_file = t!(File::options().write(true).open(dst));
t!(dst_file.set_times(file_times));
}
}
Expand Down

0 comments on commit 01a97ed

Please sign in to comment.