From 5eb6e6e2fe916fd1c5bba787a114ef794b01a80f Mon Sep 17 00:00:00 2001 From: Kornel Date: Thu, 19 Sep 2024 19:29:50 +0100 Subject: [PATCH] Exit directly instead of panicking --- src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5e6a3b10..ee7cb28d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -124,11 +124,15 @@ impl Build { false } - #[track_caller] + /// Exits the process on failure. Use `try_build` to handle the error. pub fn build(&mut self) -> Artifacts { match self.try_build() { Ok(a) => a, - Err(e) => panic!("\n\n\n{e}\n\n\n"), + Err(e) => { + println!("cargo:warning=openssl-src: failed to build OpenSSL from source"); + eprintln!("\n\n\n{e}\n\n\n"); + std::process::exit(101); // same as a panic + } } }