From dd511df194fa3ff2c4d79bccc1d35e07c2d6c434 Mon Sep 17 00:00:00 2001 From: Nikita Nemkin Date: Thu, 2 Jun 2011 01:19:44 +0600 Subject: [PATCH] Replaced WMI process enumeration with the EnumProcesses API call. (Shorter, faster, does not depend on pythoncom.) --- deluge/core/daemon.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/deluge/core/daemon.py b/deluge/core/daemon.py index 6a1648bbb..55e46aa27 100644 --- a/deluge/core/daemon.py +++ b/deluge/core/daemon.py @@ -63,13 +63,8 @@ class Daemon(object): def process_running(pid): if deluge.common.windows_check(): - # Do some fancy WMI junk to see if the PID exists in Windows - from win32com.client import GetObject - def get_proclist(): - WMI = GetObject('winmgmts:') - processes = WMI.InstancesOf('Win32_Process') - return [process.Properties_('ProcessID').Value for process in processes] - return pid in get_proclist() + import win32process + return pid in win32process.EnumProcesses() else: # We can just use os.kill on UNIX to test if the process is running try: