Skip to content

Commit

Permalink
chore(build): try remove_file on windows (#1529)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Jul 15, 2024
1 parent 7107d48 commit b590c12
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "v8"
version = "0.98.0"
version = "0.98.1"
description = "Rust bindings to V8"
readme = "README.md"
authors = ["the Deno authors"]
Expand Down
14 changes: 12 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ fn maybe_symlink_root_dir(dirs: &mut Dirs) {
// symlink called 'gn_root' in the out directory, next to 'gn_out', so it
// appears as if they're both on the same drive.
use std::fs::remove_dir_all;
use std::fs::remove_file;
use std::os::windows::fs::symlink_dir;

let get_prefix = |p: &Path| {
Expand All @@ -850,13 +851,22 @@ fn maybe_symlink_root_dir(dirs: &mut Dirs) {
Ok(_) => remove_dir_all(symlink).expect("remove_dir_all failed"),
Err(err) => {
println!("symlink.canonicalize failed: {:?}", err);
let _ = remove_dir_all(symlink);
// we're having very strange issues on GHA when the cache
// is restored, so trying this out temporarily
if let Err(err) = remove_dir_all(symlink) {
eprintln!("remove_dir_all failed: {:?}", err);
if let Err(err) = remove_file(symlink) {
eprintln!("remove_file failed: {:?}", err);
}
}
match symlink_dir(target, symlink) {
Ok(_) => break,
Err(err) => {
println!("symlink_dir failed: {:?}", err);
retries += 1;
std::thread::sleep(std::time::Duration::from_millis(100));
std::thread::sleep(std::time::Duration::from_millis(
50 * retries,
));
if retries > 4 {
panic!("Failed to create symlink");
}
Expand Down

0 comments on commit b590c12

Please sign in to comment.