From 28525359d3a72d25702395175cff2abfcf4b73d7 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Fri, 6 Jun 2025 17:36:07 +1000 Subject: [PATCH] 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> --- crates/bin/build.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/crates/bin/build.rs b/crates/bin/build.rs index ed3b0772..617c8d87 100644 --- a/crates/bin/build.rs +++ b/crates/bin/build.rs @@ -11,17 +11,7 @@ fn succeeds(res: io::Result) -> 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(); + }); }