From e91c404201bda5ff0cef2955c38449dba02bcecb Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sat, 21 Dec 2024 13:49:25 +0100 Subject: [PATCH] BSD cmdline() --- psutil/_psbsd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py index 8334fa128..abd79ed35 100644 --- a/psutil/_psbsd.py +++ b/psutil/_psbsd.py @@ -698,10 +698,12 @@ def cmdline(self): return cext.proc_cmdline(self.pid) except OSError as err: if err.errno == errno.EINVAL: + # fmt: off if is_zombie(self.pid): - raise ZombieProcess(self.pid, self._name, self._ppid) + raise ZombieProcess(self.pid, self._name, self._ppid) from err # noqa: E501 elif not pid_exists(self.pid): - raise NoSuchProcess(self.pid, self._name, self._ppid) + raise NoSuchProcess(self.pid, self._name, self._ppid) from err # noqa: E501 + # fmt: on else: # XXX: this happens with unicode tests. It means the C # routine is unable to decode invalid unicode chars.