Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for cppwinrt concurrency issue #3289

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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