Ensure cargo-binstall build.rs always join the thread (#2185)

Make sure the build script waits for it to finish before exiting the whole process

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Jiahao XU 2025-06-06 17:36:07 +10:00 committed by GitHub
parent 9539174474
commit 28525359d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,17 +11,7 @@ fn succeeds(res: io::Result<Child>) -> bool {
.unwrap_or(false)
}
fn main() {
let handle = thread::spawn(|| {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=manifest.rc");
println!("cargo:rerun-if-changed=windows.manifest");
embed_resource::compile("manifest.rc", embed_resource::NONE)
.manifest_required()
.unwrap();
});
fn emit_vergen_info() {
let git = Command::new("git").arg("--version").spawn();
// .git is usually a dir, but it also can be a file containing
@ -41,6 +31,22 @@ fn main() {
}
builder.emit().unwrap();
handle.join().unwrap();
}
fn main() {
thread::scope(|s| {
let handle = s.spawn(|| {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=manifest.rc");
println!("cargo:rerun-if-changed=windows.manifest");
embed_resource::compile("manifest.rc", embed_resource::NONE)
.manifest_required()
.unwrap();
});
emit_vergen_info();
handle.join().unwrap();
});
}