##// END OF EJS Templates
killdaemons: explicitly set the ctypes signatures...
Matt Harbison -
r32857:d644e859 default
parent child Browse files
Show More
@@ -10,6 +10,26 b' import time'
10 if os.name =='nt':
10 if os.name =='nt':
11 import ctypes
11 import ctypes
12
12
13 _BOOL = ctypes.c_long
14 _DWORD = ctypes.c_ulong
15 _UINT = ctypes.c_uint
16 _HANDLE = ctypes.c_void_p
17
18 ctypes.windll.kernel32.CloseHandle.argtypes = [_HANDLE]
19 ctypes.windll.kernel32.CloseHandle.restype = _BOOL
20
21 ctypes.windll.kernel32.GetLastError.argtypes = []
22 ctypes.windll.kernel32.GetLastError.restype = _DWORD
23
24 ctypes.windll.kernel32.OpenProcess.argtypes = [_DWORD, _BOOL, _DWORD]
25 ctypes.windll.kernel32.OpenProcess.restype = _HANDLE
26
27 ctypes.windll.kernel32.TerminateProcess.argtypes = [_HANDLE, _UINT]
28 ctypes.windll.kernel32.TerminateProcess.restype = _BOOL
29
30 ctypes.windll.kernel32.WaitForSingleObject.argtypes = [_HANDLE, _DWORD]
31 ctypes.windll.kernel32.WaitForSingleObject.restype = _DWORD
32
13 def _check(ret, expectederr=None):
33 def _check(ret, expectederr=None):
14 if ret == 0:
34 if ret == 0:
15 winerrno = ctypes.GetLastError()
35 winerrno = ctypes.GetLastError()
@@ -27,7 +47,7 b" if os.name =='nt':"
27 handle = ctypes.windll.kernel32.OpenProcess(
47 handle = ctypes.windll.kernel32.OpenProcess(
28 PROCESS_TERMINATE|SYNCHRONIZE|PROCESS_QUERY_INFORMATION,
48 PROCESS_TERMINATE|SYNCHRONIZE|PROCESS_QUERY_INFORMATION,
29 False, pid)
49 False, pid)
30 if handle == 0:
50 if handle is None:
31 _check(0, 87) # err 87 when process not found
51 _check(0, 87) # err 87 when process not found
32 return # process not found, already finished
52 return # process not found, already finished
33 try:
53 try:
General Comments 0
You need to be logged in to leave comments. Login now