summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-07-19 11:45:53 +0300
committerLars Wirzenius <liw@liw.fi>2020-07-19 13:28:44 +0300
commite50eea1299a337a4c2164e069ab0bfa65609424f (patch)
tree0bcf579cd891270b73b63160b305cd8979967a42
parent8fc8c54d9f5973df0a1085ae357bc8bb97fba534 (diff)
downloadewww-e50eea1299a337a4c2164e069ab0bfa65609424f.tar.gz
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.
-rw-r--r--daemon.py9
1 files 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