summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Nemkin <nikita@nemkin.ru>2011-06-02 01:19:44 +0600
committerCalum Lind <calumlind+deluge@gmail.com>2012-11-06 22:30:19 +0000
commit8a72187998c42979bb5466c4ea4d1789f2bfd9bc (patch)
tree602e5b9e86241e63f9207a182c009ad977cd192a
parentd9f1210fe7161395c877d1a6ef4ff78e03420c90 (diff)
downloaddeluge-8a72187998.zip
deluge-8a72187998.tar.gz
deluge-8a72187998.tar.bz2
Replaced WMI process enumeration with the EnumProcesses API call. (Shorter, faster, does not depend on pythoncom.)
-rw-r--r--deluge/core/daemon.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/deluge/core/daemon.py b/deluge/core/daemon.py
index bac5b69..1cb573c 100644
--- a/deluge/core/daemon.py
+++ b/deluge/core/daemon.py
@@ -62,13 +62,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: