diff options
Diffstat (limited to 'psutil/_psutil_osx.c')
-rw-r--r-- | psutil/_psutil_osx.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c index 92d48dd4..450f1db0 100644 --- a/psutil/_psutil_osx.c +++ b/psutil/_psutil_osx.c @@ -1003,10 +1003,13 @@ psutil_proc_threads(PyObject *self, PyObject *args) { if (! PyArg_ParseTuple(args, "l", &pid)) goto error; - // task_for_pid() requires special privileges + // task_for_pid() requires root privileges err = task_for_pid(mach_task_self(), (pid_t)pid, &task); if (err != KERN_SUCCESS) { - psutil_raise_for_pid(pid, "task_for_pid() failed"); + if (psutil_pid_exists(pid) == 0) + NoSuchProcess(); + else + AccessDenied(); goto error; } |