From f25954f303cf4ca58eadaf128f642f4a4d90bb22 Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Fri, 13 Jul 2018 13:29:35 -0700 Subject: [PATCH] Ignore gpg-agent processes that are zombies --- pretty_bad_protocol/_meta.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pretty_bad_protocol/_meta.py b/pretty_bad_protocol/_meta.py index 9df6163..fa36b0c 100644 --- a/pretty_bad_protocol/_meta.py +++ b/pretty_bad_protocol/_meta.py @@ -111,8 +111,9 @@ def _find_agent(cls): identity = this_process.uids for proc in psutil.process_iter(): - # In my system proc.name & proc.is_running are methods - if (proc.name() == "gpg-agent") and proc.is_running(): + # Ensure that the process is running and is not a zombie. + if (proc.name() == "gpg-agent" and proc.is_running() and + proc.status() != psutil.STATUS_ZOMBIE): log.debug("Found gpg-agent process with pid %d" % proc.pid) if _util._running_windows: if proc.username() == identity: