Check output of build command and panic if not successful (#1278)

This commit is contained in:
Amin Moghaddam 2024-02-08 12:31:18 +01:00 committed by GitHub
parent 5c8e372ef6
commit 89e67be9af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -26,11 +26,17 @@ fn main() {
// Run each command to prepare the OUT_DIR with the protobuf definitions. We need to make sure
// to change the working directory to OUT_DIR, otherwise git will complain.
let _ = Command::new("sh")
let output = Command::new("sh")
.args(["-c", protobuf_setup])
.current_dir(&out_dir)
.output()
.expect("failed to setup protobuf definitions");
.expect("failed to run protobuf setup commands");
if !output.status.success() {
panic!(
"failed to setup protobuf definitions: {}",
String::from_utf8_lossy(&output.stderr)
);
}
// We build the resulting protobuf definitions using Rust's prost_build crate, which generates
// Rust code from the protobuf definitions.