From 70f580e22e82dc26831cd759c56501c72a8db00f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 8 Oct 2012 06:48:55 -0700 Subject: ForkProcess: increase scope of try/finally/_exit This minimizes the probability of triggering irrelevant finally blocks from earlier in the call stack (bug #345289). --- pym/portage/util/_async/ForkProcess.py | 20 +++++++++++--------- 1 file 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 -- cgit v1.2.3-1-g7c22