Improve yosys-smtbmc "solver not found" handling
authorClaire Wolf <clifford@clifford.at>
Mon, 27 Jan 2020 16:48:56 +0000 (17:48 +0100)
committerClaire Wolf <clifford@clifford.at>
Mon, 27 Jan 2020 16:48:56 +0000 (17:48 +0100)
Signed-off-by: Claire Wolf <clifford@clifford.at>
backends/smt2/smtio.py

index 1df996aa7b8e63a8d32e89a2d1e540059dc86305..34bf7ef38eea2b251efb035f1197ebf1c476214a 100644 (file)
@@ -304,7 +304,11 @@ class SmtIo:
 
     def p_open(self):
         assert self.p is None
-        self.p = subprocess.Popen(self.popen_vargs, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        try:
+            self.p = subprocess.Popen(self.popen_vargs, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        except FileNotFoundError:
+            print("%s SMT Solver '%s' not found in path." % (self.timestamp(), self.popen_vargs[0]), flush=True)
+            sys.exit(1)
         running_solvers[self.p_index] = self.p
         self.p_running = True
         self.p_next = None