Browse Source

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

Amin Moghaddam 1 year ago
parent
commit
89e67be9af
1 changed files with 8 additions and 2 deletions
  1. 8 2
      hermes/build.rs

+ 8 - 2
hermes/build.rs

@@ -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.