Skip to content

Commit

Permalink
Exit directly instead of panicking
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Sep 19, 2024
1 parent 4791204 commit 5eb6e6e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 5eb6e6e

Please sign in to comment.