ignore race condition in killing already-terminated process
authorN. Engelhardt <nak@symbioticeda.com>
Tue, 16 Jun 2020 10:41:26 +0000 (12:41 +0200)
committerN. Engelhardt <nak@symbioticeda.com>
Tue, 16 Jun 2020 10:41:26 +0000 (12:41 +0200)
sbysrc/sby_core.py

index 972e04786f6696b953f971f2986bb9c817757a79..5e3469685cee520f4c06c174862c4c76c6c4bfae 100644 (file)
@@ -118,7 +118,10 @@ class SbyTask:
             if not self.silent:
                 self.job.log("{}: terminating process".format(self.info))
             if os.name == "posix":
-                os.killpg(self.p.pid, signal.SIGTERM)
+                try:
+                    os.killpg(self.p.pid, signal.SIGTERM)
+                except PermissionError:
+                    pass
             self.p.terminate()
             self.job.tasks_running.remove(self)
             all_tasks_running.remove(self)