From b9771b51003d49680bb7e14ff4deeed8f0af5a10 Mon Sep 17 00:00:00 2001
From: Alex Wiens <alex.wiens@uni-paderborn.de>
Date: Mon, 17 Feb 2025 18:41:41 +0100
Subject: [PATCH] Prule.daemon: PruleThread: Add additional exception catching
 for process termination

---
 prule/daemon/__main__.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/prule/daemon/__main__.py b/prule/daemon/__main__.py
index 75847ed..20ca655 100644
--- a/prule/daemon/__main__.py
+++ b/prule/daemon/__main__.py
@@ -739,8 +739,14 @@ class PruleThread(threading.Thread):
             if self.currentProcess == None:
                 return None
             proc = self.currentProcess
-        self.currentProcess.stdin.close()
-        self.currentProcess.terminate()
+        try:
+            self.currentProcess.stdin.close()
+        except:
+            pass
+        try:
+            self.currentProcess.terminate()
+        except:
+            pass
         returncode = self.currentProcess.wait()
         print("Prule process {} stopped, returncode {}".format(self.currentProcess.pid, returncode))
         with self.stopCondition:
-- 
GitLab