windows check_pid

This commit is contained in:
j 2019-01-29 19:09:25 +05:30
parent 1c99e3277b
commit 5bf87bc64d

View file

@ -369,6 +369,17 @@ def update_static():
)
def check_pid(pid):
if sys.platform == 'win32':
import ctypes
kernel32 = ctypes.windll.kernel32
SYNCHRONIZE = 0x100000
process = kernel32.OpenProcess(SYNCHRONIZE, 0, pid)
if process != 0:
kernel32.CloseHandle(process)
return True
else:
return False
else:
try:
os.kill(pid, 0)
except: