From e50eea1299a337a4c2164e069ab0bfa65609424f Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 19 Jul 2020 11:45:53 +0300 Subject: test: log call of terminate_process, and its failure This avoids an ugly and unnecessary stack trace when ewww failed to start, and thus there is no process with the assumed pid. Also, this makes debugging test failures a little easier. --- daemon.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index 33057bd..585fe5a 100644 --- a/daemon.py +++ b/daemon.py @@ -65,5 +65,10 @@ def process_exists(pid): # Terminate process. -def terminate_process(pid, signal): - os.kill(pid, signal) +def terminate_process(pid, signalno): + logging.debug(f"Terminating process {pid} with signal {signalno}") + try: + os.kill(pid, signalno) + except ProcessLookupError: + logging.debug("Process did not actually exist (anymore?)") + pass -- cgit v1.2.1