Show More
@@ -535,9 +535,10 b" if os.name == 'nt':" | |||||
535 | pf = pf[1:-1] # Remove the quotes |
|
535 | pf = pf[1:-1] # Remove the quotes | |
536 | return pf |
|
536 | return pf | |
537 |
|
537 | |||
538 | try: # ActivePython can create hard links using win32file module |
|
538 | try: # Mark Hammond's win32all package allows better functionality on Windows | |
539 | import win32api, win32con, win32file |
|
539 | import win32api, win32con, win32file, pywintypes | |
540 |
|
540 | |||
|
541 | # create hard links using win32file module | |||
541 | def os_link(src, dst): # NB will only succeed on NTFS |
|
542 | def os_link(src, dst): # NB will only succeed on NTFS | |
542 | win32file.CreateHardLink(dst, src) |
|
543 | win32file.CreateHardLink(dst, src) | |
543 |
|
544 | |||
@@ -554,12 +555,19 b" if os.name == 'nt':" | |||||
554 | return os.stat(pathname).st_nlink |
|
555 | return os.stat(pathname).st_nlink | |
555 |
|
556 | |||
556 | def testpid(pid): |
|
557 | def testpid(pid): | |
557 |
'''return |
|
558 | '''return True if pid is still running or unable to determine, False otherwise''' | |
558 | try: |
|
559 | try: | |
559 | win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION, |
|
560 | handle = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION, False, pid) | |
560 | False, pid) |
|
561 | if handle: | |
561 | except: |
|
562 | status = win32process.GetExitCodeProcess(handle) | |
562 | return True |
|
563 | if status == win32con.STILL_ACTIVE: | |
|
564 | return True | |||
|
565 | else: | |||
|
566 | return False | |||
|
567 | except pywintypes.error, details: | |||
|
568 | if details[0] == 87: # ERROR_INVALID_PARAMETER | |||
|
569 | return False | |||
|
570 | return True | |||
563 |
|
571 | |||
564 | except ImportError: |
|
572 | except ImportError: | |
565 | def testpid(pid): |
|
573 | def testpid(pid): |
General Comments 0
You need to be logged in to leave comments.
Login now