From: Zac Medico Date: Mon, 8 Oct 2012 13:48:55 +0000 (-0700) Subject: ForkProcess: increase scope of try/finally/_exit X-Git-Tag: v2.2.0_alpha136~11 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=70f580e22e82dc26831cd759c56501c72a8db00f;p=portage.git ForkProcess: increase scope of try/finally/_exit This minimizes the probability of triggering irrelevant finally blocks from earlier in the call stack (bug #345289). --- 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