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 | |
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')
-rw-r--r-- | rdiff-backup/CHANGELOG | 4 | ||||
-rw-r--r-- | rdiff-backup/rdiff_backup/regress.py | 15 | ||||
-rw-r--r-- | rdiff-backup/rdiff_backup/robust.py | 7 |
3 files changed, 25 insertions, 1 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index b1b3b24..226a686 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,6 +1,10 @@ New in v1.1.16 (????/??/??) --------------------------- +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) + Do not use inode numbers on Windows and gracefully handle attempts to rename over existing files on Windows. (Patch from Josh Nisly) 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: diff --git a/rdiff-backup/rdiff_backup/robust.py b/rdiff-backup/rdiff_backup/robust.py index 9dd0d85..df190d4 100644 --- a/rdiff-backup/rdiff_backup/robust.py +++ b/rdiff-backup/rdiff_backup/robust.py @@ -104,7 +104,12 @@ def signal_handler(signum, frame): def install_signal_handlers(): """Install signal handlers on current connection""" - for signum in [signal.SIGQUIT, signal.SIGHUP, signal.SIGTERM]: + signals = [signal.SIGTERM, signal.SIGINT] + try: + signals.extend([signal.SIGHUP, signal.SIGQUIT]) + except AttributeError: + pass + for signum in signals: signal.signal(signum, signal_handler) |