txlyre 4 months ago
parent
commit
c94aa3efe5
1 changed files with 7 additions and 3 deletions
  1. 7 3
      main.py

+ 7 - 3
main.py

@@ -6,6 +6,7 @@ import queue
 import argparse
 import tempfile
 import threading
+import subprocess
 from itertools import groupby
 
 import cv2
@@ -72,9 +73,12 @@ def chunks(lst, n):
 def run_check(cmd):
     logger.info(f"Executing '{cmd}'.")
 
-    if os.system(cmd) != 0:
-        raise ValueError("Exit code != 0.")
-
+    subprocess.check_output(
+        cmd,
+        stdout=subprocess.STDOUT,
+        stderr=subprocess.STDOUT,
+        timeout=100
+    )
 
 def extract_image(path):
     logger.info(f"Extract image '{path}'.")