# HG changeset patch # User Vadim Gelfer # Date 1143772024 28800 # Node ID 581d9a8b5fb932589a077c778069ae0feaf053eb # Parent 6328445b0e71754c3ce6d89c7fb8c3773488c4a5 clean up lee's windows testpid fix. diff -r 6328445b0e71 -r 581d9a8b5fb9 mercurial/util.py --- a/mercurial/util.py Thu Mar 30 18:20:08 2006 -0800 +++ b/mercurial/util.py Thu Mar 30 18:27:04 2006 -0800 @@ -536,7 +536,7 @@ return pf try: # Mark Hammond's win32all package allows better functionality on Windows - import win32api, win32con, win32file, pywintypes + import win32api, win32con, win32file, winerror, pywintypes # create hard links using win32file module def os_link(src, dst): # NB will only succeed on NTFS @@ -555,18 +555,16 @@ return os.stat(pathname).st_nlink def testpid(pid): - '''return True if pid is still running or unable to determine, False otherwise''' + '''return True if pid is still running or unable to + determine, False otherwise''' try: - handle = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION, False, pid) + handle = win32api.OpenProcess( + win32con.PROCESS_QUERY_INFORMATION, False, pid) if handle: status = win32process.GetExitCodeProcess(handle) - if status == win32con.STILL_ACTIVE: - return True - else: - return False + return status == win32con.STILL_ACTIVE except pywintypes.error, details: - if details[0] == 87: # ERROR_INVALID_PARAMETER - return False + return details[0] != winerror.ERROR_INVALID_PARAMETER return True except ImportError: