diff options
author | owsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2008-06-10 13:09:27 +0000 |
---|---|---|
committer | owsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2008-06-10 13:09:27 +0000 |
commit | 03768c4b2befa8a6cc619a25097a232b36243909 (patch) | |
tree | a2088ae522408662c08783bc049adc20a117f2c9 /rdiff-backup/rdiff_backup/regress.py | |
parent | fce09cb7e56fa39daaecce4ee320fffe2960d162 (diff) | |
download | rdiff-backup-03768c4b2befa8a6cc619a25097a232b36243909.tar.gz |
Add Windows-specific logic for checking if another rdiff-backup process
is running. Do not try to handle non-existant SIGHUP and SIGQUIT signals
on Windows. (Patch from Josh Nisly)
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@887 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/regress.py')
-rw-r--r-- | rdiff-backup/rdiff_backup/regress.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rdiff-backup/rdiff_backup/regress.py b/rdiff-backup/rdiff_backup/regress.py index ca1591d..f8d1f6d 100644 --- a/rdiff-backup/rdiff_backup/regress.py +++ b/rdiff-backup/rdiff_backup/regress.py @@ -348,6 +348,21 @@ def check_pids(curmir_incs): except OSError, exc: if exc[0] == errno.ESRCH: return 0 else: log.Log("Warning: unable to check if PID %d still running" % (pid,), 2) + except AttributeError: + assert os.name == 'nt' + import win32api, win32con, pywintypes + try: + process = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, + 0, pid) + except pywintypes.error, error: + if error[0] == 87: return 0 + else: + msg = "Warning: unable to check if PID %d still running" + log.Log(msg % pid, 2) + if process: + win32api.CloseHandle(process) + return 1 + return 0 return 1 for curmir_rp in curmir_incs: |