From 97d2284534fe1ebafd4bf466461390e7b0a66d7f Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sun, 24 May 2020 22:42:41 +0200 Subject: maybe we have a zombie process detection on OSX --- psutil/_psbsd.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'psutil/_psbsd.py') diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py index 49ad1e99..d53eb042 100644 --- a/psutil/_psbsd.py +++ b/psutil/_psbsd.py @@ -551,10 +551,10 @@ def wrap_exceptions(fun): try: return fun(self, *args, **kwargs) except ProcessLookupError: - if not pid_exists(self.pid): - raise NoSuchProcess(self.pid, self._name) - else: + if is_zombie(self.pid): raise ZombieProcess(self.pid, self._name, self._ppid) + else: + raise NoSuchProcess(self.pid, self._name) except PermissionError: raise AccessDenied(self.pid, self._name) except OSError: @@ -576,10 +576,10 @@ def wrap_exceptions_procfs(inst): # ENOENT (no such file or directory) gets raised on open(). # ESRCH (no such process) can get raised on read() if # process is gone in meantime. - if not pid_exists(inst.pid): - raise NoSuchProcess(inst.pid, inst._name) - else: + if is_zombie(inst.pid): raise ZombieProcess(inst.pid, inst._name, inst._ppid) + else: + raise NoSuchProcess(inst.pid, inst._name) except PermissionError: raise AccessDenied(inst.pid, inst._name) -- cgit v1.2.1