Skip to content

Commit

Permalink
NetBSD, cmdline(): add debug message on EINVAL (re. to #2250)
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed May 2, 2023
1 parent 4d5b9e8 commit 7290661
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions psutil/_psbsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from ._common import ZombieProcess
from ._common import conn_tmap
from ._common import conn_to_ntuple
from ._common import debug
from ._common import memoize
from ._common import memoize_when_activated
from ._common import usage_percent
Expand Down Expand Up @@ -662,10 +663,10 @@ def cmdline(self):
if OPENBSD and self.pid == 0:
return [] # ...else it crashes
elif NETBSD:
# XXX - most of the times the underlying sysctl() call on Net
# and Open BSD returns a truncated string.
# Also /proc/pid/cmdline behaves the same so it looks
# like this is a kernel bug.
# XXX - most of the times the underlying sysctl() call on
# NetBSD and OpenBSD returns a truncated string. Also
# /proc/pid/cmdline behaves the same so it looks like this
# is a kernel bug.
try:
return cext.proc_cmdline(self.pid)
except OSError as err:
Expand All @@ -677,6 +678,7 @@ def cmdline(self):
else:
# XXX: this happens with unicode tests. It means the C
# routine is unable to decode invalid unicode chars.
debug("ignoring %r and returning an empty list" % err)
return []
else:
raise
Expand Down

0 comments on commit 7290661

Please sign in to comment.