From 0bc345be0bd6a61a6f3b5657057a07ca4f9622b1 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Tue, 30 May 2017 17:34:22 +0200 Subject: #1099: look for ERROR_ACCESS_DENIED instead of using pid_is_running() --- psutil/_psutil_windows.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index b8912bbb..90ef2d44 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -344,12 +344,9 @@ psutil_proc_kill(PyObject *self, PyObject *args) { // kill the process if (! TerminateProcess(hProcess, 0)) { err = GetLastError(); - CloseHandle(hProcess); // See: https://github.com/giampaolo/psutil/issues/1099 - if (psutil_pid_is_running(pid) == 0) { - Py_RETURN_NONE; - } - else { + if (err != ERROR_ACCESS_DENIED) { + CloseHandle(hProcess); PyErr_SetFromWindowsErr(err); return NULL; } -- cgit v1.2.1