Commit 5c46c373 authored by owsla's avatar owsla

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@887 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 9664d99e
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)
......
......@@ -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:
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment