From c241d839f2f82e5a979ec89c8da22b111b7cc22d Mon Sep 17 00:00:00 2001
From: Erin <erin@erindesu.cz>
Date: Sat, 7 Jan 2023 22:32:40 +0100
Subject: [PATCH] [REPBUILD] fail to run when kernel fails building

---
 repbuild/src/main.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs
index bfd139e..c218942 100644
--- a/repbuild/src/main.rs
+++ b/repbuild/src/main.rs
@@ -89,7 +89,11 @@ fn build(release: bool) -> Result<(), Error> {
         com.arg("-r");
     }
 
-    com.status().into_report().change_context(Error::Build)?;
+    match com.status() {
+        Ok(s) if s.code() != Some(0) => bail!(Error::Build),
+        Err(e) => bail!(report!(e).change_context(Error::Build)),
+        _ => (),
+    }
 
     (|| -> std::io::Result<_> {
         io::copy(