##// END OF EJS Templates
merge with stable
Matt Mackall -
r24426:8e477ad4 merge default
parent child Browse files
Show More
@@ -279,7 +279,7 b' def executablepath():'
279 buf = ctypes.create_string_buffer(size + 1)
279 buf = ctypes.create_string_buffer(size + 1)
280 len = _kernel32.GetModuleFileNameA(None, ctypes.byref(buf), size)
280 len = _kernel32.GetModuleFileNameA(None, ctypes.byref(buf), size)
281 if len == 0:
281 if len == 0:
282 raise ctypes.WinError
282 raise ctypes.WinError()
283 elif len == size:
283 elif len == size:
284 raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER)
284 raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER)
285 return buf.value
285 return buf.value
@@ -289,7 +289,7 b' def getuser():'
289 size = _DWORD(300)
289 size = _DWORD(300)
290 buf = ctypes.create_string_buffer(size.value + 1)
290 buf = ctypes.create_string_buffer(size.value + 1)
291 if not _advapi32.GetUserNameA(ctypes.byref(buf), ctypes.byref(size)):
291 if not _advapi32.GetUserNameA(ctypes.byref(buf), ctypes.byref(size)):
292 raise ctypes.WinError
292 raise ctypes.WinError()
293 return buf.value
293 return buf.value
294
294
295 _signalhandler = []
295 _signalhandler = []
@@ -307,7 +307,7 b' def setsignalhandler():'
307 h = _SIGNAL_HANDLER(handler)
307 h = _SIGNAL_HANDLER(handler)
308 _signalhandler.append(h) # needed to prevent garbage collection
308 _signalhandler.append(h) # needed to prevent garbage collection
309 if not _kernel32.SetConsoleCtrlHandler(h, True):
309 if not _kernel32.SetConsoleCtrlHandler(h, True):
310 raise ctypes.WinError
310 raise ctypes.WinError()
311
311
312 def hidewindow():
312 def hidewindow():
313
313
@@ -349,7 +349,7 b' def _1stchild(pid):'
349 # create handle to list all processes
349 # create handle to list all processes
350 ph = _kernel32.CreateToolhelp32Snapshot(_TH32CS_SNAPPROCESS, 0)
350 ph = _kernel32.CreateToolhelp32Snapshot(_TH32CS_SNAPPROCESS, 0)
351 if ph == _INVALID_HANDLE_VALUE:
351 if ph == _INVALID_HANDLE_VALUE:
352 raise ctypes.WinError
352 raise ctypes.WinError()
353 try:
353 try:
354 r = _kernel32.Process32First(ph, ctypes.byref(pe))
354 r = _kernel32.Process32First(ph, ctypes.byref(pe))
355 # loop over all processes
355 # loop over all processes
@@ -361,7 +361,7 b' def _1stchild(pid):'
361 finally:
361 finally:
362 _kernel32.CloseHandle(ph)
362 _kernel32.CloseHandle(ph)
363 if _kernel32.GetLastError() != _ERROR_NO_MORE_FILES:
363 if _kernel32.GetLastError() != _ERROR_NO_MORE_FILES:
364 raise ctypes.WinError
364 raise ctypes.WinError()
365 return None # no child found
365 return None # no child found
366
366
367 class _tochildpid(int): # pid is _DWORD, which always matches in an int
367 class _tochildpid(int): # pid is _DWORD, which always matches in an int
@@ -413,7 +413,7 b' def spawndetached(args):'
413 None, args, None, None, False, _CREATE_NO_WINDOW,
413 None, args, None, None, False, _CREATE_NO_WINDOW,
414 env, os.getcwd(), ctypes.byref(si), ctypes.byref(pi))
414 env, os.getcwd(), ctypes.byref(si), ctypes.byref(pi))
415 if not res:
415 if not res:
416 raise ctypes.WinError
416 raise ctypes.WinError()
417
417
418 # _tochildpid because the process is the child of COMSPEC
418 # _tochildpid because the process is the child of COMSPEC
419 return _tochildpid(pi.dwProcessId)
419 return _tochildpid(pi.dwProcessId)
General Comments 0
You need to be logged in to leave comments. Login now