From c5063c59ec17ef6d1ae9eddb5f27a0a1ca9b09a2 Mon Sep 17 00:00:00 2001
From: Russel Arbore <rarbore2@illinois.edu>
Date: Mon, 24 Feb 2025 11:18:30 -0600
Subject: [PATCH] panic if xdot can't be run

---
 hercules_ir/src/dot.rs | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hercules_ir/src/dot.rs b/hercules_ir/src/dot.rs
index aff1f9c5..f21137f8 100644
--- a/hercules_ir/src/dot.rs
+++ b/hercules_ir/src/dot.rs
@@ -44,10 +44,17 @@ pub fn xdot_module(
     file.write_all(contents.as_bytes())
         .expect("PANIC: Unable to write output file contents.");
     println!("Graphviz written to: {}", tmp_path.display());
-    Command::new("xdot")
+    let mut xdot_process = Command::new("xdot")
         .args([&tmp_path])
-        .output()
+        .spawn()
         .expect("PANIC: Couldn't execute xdot. Is xdot installed?");
+    assert!(
+        xdot_process
+            .wait()
+            .map(|status| status.success())
+            .unwrap_or(false),
+        "PANIC: Xdot failed to execute."
+    )
 }
 
 /*
-- 
GitLab