diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-10-08 06:48:55 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-10-08 06:48:55 -0700 |
commit | 70f580e22e82dc26831cd759c56501c72a8db00f (patch) | |
tree | b4e859282015676e1c79c2dd54ee778c0b7aa966 /pym | |
parent | 00d168d306635ab407dec3db50dd36e99bb44375 (diff) | |
download | portage-70f580e22e82dc26831cd759c56501c72a8db00f.tar.gz portage-70f580e22e82dc26831cd759c56501c72a8db00f.tar.bz2 portage-70f580e22e82dc26831cd759c56501c72a8db00f.zip |
ForkProcess: increase scope of try/finally/_exit
This minimizes the probability of triggering irrelevant finally blocks
from earlier in the call stack (bug #345289).
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage/util/_async/ForkProcess.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/pym/portage/util/_async/ForkProcess.py b/pym/portage/util/_async/ForkProcess.py index 6fcd662cf..96ce3d98a 100644 --- a/pym/portage/util/_async/ForkProcess.py +++ b/pym/portage/util/_async/ForkProcess.py @@ -25,17 +25,19 @@ class ForkProcess(SpawnProcess): portage.process.spawned_pids.append(pid) return [pid] - portage.locks._close_fds() - # Disable close_fds since we don't exec (see _setup_pipes docstring). - portage.process._setup_pipes(fd_pipes, close_fds=False) - - # Use default signal handlers in order to avoid problems - # killing subprocesses as reported in bug #353239. - signal.signal(signal.SIGINT, signal.SIG_DFL) - signal.signal(signal.SIGTERM, signal.SIG_DFL) - rval = 1 try: + + # Use default signal handlers in order to avoid problems + # killing subprocesses as reported in bug #353239. + signal.signal(signal.SIGINT, signal.SIG_DFL) + signal.signal(signal.SIGTERM, signal.SIG_DFL) + + portage.locks._close_fds() + # We don't exec, so use close_fds=False + # (see _setup_pipes docstring). + portage.process._setup_pipes(fd_pipes, close_fds=False) + rval = self._run() except SystemExit: raise |