mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 15:08:40 +00:00
Replaced WMI process enumeration with the EnumProcesses API call. (Shorter, faster, does not depend on pythoncom.)
This commit is contained in:
parent
e43e4e2ee0
commit
dd511df194
1 changed files with 2 additions and 7 deletions
|
@ -63,13 +63,8 @@ class Daemon(object):
|
||||||
|
|
||||||
def process_running(pid):
|
def process_running(pid):
|
||||||
if deluge.common.windows_check():
|
if deluge.common.windows_check():
|
||||||
# Do some fancy WMI junk to see if the PID exists in Windows
|
import win32process
|
||||||
from win32com.client import GetObject
|
return pid in win32process.EnumProcesses()
|
||||||
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()
|
|
||||||
else:
|
else:
|
||||||
# We can just use os.kill on UNIX to test if the process is running
|
# We can just use os.kill on UNIX to test if the process is running
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue