Skip to content

Commit

Permalink
Fix cppwinrt build concurrency (#3289)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Sep 20, 2024
1 parent bf53fa6 commit 26635b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/libs/cppwinrt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ where
let mut path = std::env::temp_dir();
path.push(format!("cppwinrt-{VERSION}.exe"));

std::fs::write(&path, std::include_bytes!("../cppwinrt.exe")).unwrap();
let bytes = std::include_bytes!("../cppwinrt.exe");

// Concurrent builds can cause this to fail, so we just make sure the bytes match on failure.
if std::fs::write(&path, bytes).is_err() {
assert_eq!(*bytes, *std::fs::read(&path).unwrap());
}

let mut command = std::process::Command::new(&path);
command.args(args);
let output = command.output().expect("failed to run cppwinrt");
Expand Down

0 comments on commit 26635b2

Please sign in to comment.