summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/actions.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-03 17:47:22 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-03 17:47:22 -0700
commit41a90f125ab5475d3c3afd78b1cedfa1e8b85062 (patch)
tree0db321fd3af1fe6a75ebffec360552bad651e399 /pym/_emerge/actions.py
parent7f9f0653aa142ad33c7f95b959d254e52d0a0569 (diff)
downloadportage-41a90f125ab5475d3c3afd78b1cedfa1e8b85062.tar.gz
portage-41a90f125ab5475d3c3afd78b1cedfa1e8b85062.tar.bz2
portage-41a90f125ab5475d3c3afd78b1cedfa1e8b85062.zip
Use AlarmSignal for alarm timeout in action_sync().
Diffstat (limited to 'pym/_emerge/actions.py')
-rw-r--r--pym/_emerge/actions.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index d84e434d6..0da1d685b 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2127,14 +2127,12 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
content = None
mypids = []
try:
- def timeout_handler(signum, frame):
- raise portage.exception.PortageException("timed out")
- signal.signal(signal.SIGALRM, timeout_handler)
# Timeout here in case the server is unresponsive. The
# --timeout rsync option doesn't apply to the initial
# connection attempt.
if rsync_initial_timeout:
- signal.alarm(rsync_initial_timeout)
+ portage.exception.AlarmSignal.register(
+ rsync_initial_timeout)
try:
mypids.extend(portage.process.spawn(
mycommand, returnpid=True, **spawn_kwargs))
@@ -2145,15 +2143,14 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
content = portage.grabfile(tmpservertimestampfile)
finally:
if rsync_initial_timeout:
- signal.alarm(0)
+ portage.exception.AlarmSignal.unregister()
try:
os.unlink(tmpservertimestampfile)
except OSError:
pass
- except portage.exception.PortageException as e:
+ except portage.exception.AlarmSignal:
# timed out
- print(e)
- del e
+ print('timed out')
if mypids and os.waitpid(mypids[0], os.WNOHANG) == (0,0):
os.kill(mypids[0], signal.SIGTERM)
os.waitpid(mypids[0], 0)