summaryrefslogtreecommitdiff
path: root/psutil/_psposix.py
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2013-12-17 15:35:17 +0100
committerGiampaolo Rodola' <g.rodola@gmail.com>2013-12-17 15:35:17 +0100
commit86f538826f4f8315926e5f7bf43bc6e7f4ac0ea0 (patch)
tree928f04ec29e8ad6e909335252251a6994bde7d15 /psutil/_psposix.py
parentd54c7c91bde21bce535e2be10d922378f69c8380 (diff)
downloadpsutil-86f538826f4f8315926e5f7bf43bc6e7f4ac0ea0.tar.gz
fix issue 457: [POSIX] pid_exists() always return True for PID 0.
Diffstat (limited to 'psutil/_psposix.py')
-rw-r--r--psutil/_psposix.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/psutil/_psposix.py b/psutil/_psposix.py
index 01874e0b..e7d8ea12 100644
--- a/psutil/_psposix.py
+++ b/psutil/_psposix.py
@@ -19,8 +19,7 @@ from psutil._error import TimeoutExpired
def pid_exists(pid):
"""Check whether pid exists in the current process table."""
- if pid < 0:
- return False
+ assert not pid <= 0, pid
try:
os.kill(pid, 0)
except OSError:
@@ -33,7 +32,7 @@ def pid_exists(pid):
return True
else:
# According to "man 2 kill" possible error values are
- # (EINVAL, EPERM, ESRCH) therefore we should bever get
+ # (EINVAL, EPERM, ESRCH) therefore we should never get
# here. If we do let's be explicit in considering this
# an error.
raise err