diff --git a/hercules_ir/src/dot.rs b/hercules_ir/src/dot.rs
index aff1f9c52eb8735db828620a15e27a6395b20f9f..f21137f8d5ea02347765b114d8c487ef5f3ceaaf 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."
+    )
 }
 
 /*