From 25502e16ef942ce573bdafcb29251a973753eddc Mon Sep 17 00:00:00 2001 From: "N. Engelhardt" Date: Tue, 16 Jun 2020 12:41:26 +0200 Subject: [PATCH] ignore race condition in killing already-terminated process --- sbysrc/sby_core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index 972e047..5e34696 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -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) -- 2.30.2