From 44f8dd33065d30449010d59e12ab6d0a403c22c4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 13 Nov 2010 09:16:08 -0800 Subject: [PATCH] MergeProcess: suppress finally blocks after fork This case is like bug #345289. --- pym/portage/dbapi/_MergeProcess.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py index b5af7142c..3cf50d22b 100644 --- a/pym/portage/dbapi/_MergeProcess.py +++ b/pym/portage/dbapi/_MergeProcess.py @@ -1,6 +1,8 @@ # Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import traceback + import portage from portage import os from _emerge.SpawnProcess import SpawnProcess @@ -35,7 +37,15 @@ class MergeProcess(SpawnProcess): # is triggered when dblink._scheduler is None. self.dblink._scheduler = None - rval = self.dblink._merge_process(self.srcroot, self.destroot, - self.cfgfiledict, self.conf_mem_file) - - os._exit(rval) + rval = 1 + try: + rval = self.dblink._merge_process(self.srcroot, self.destroot, + self.cfgfiledict, self.conf_mem_file) + except SystemExit: + raise + except: + traceback.print_exc() + finally: + # Call os._exit() from finally block, in order to suppress any + # finally blocks from earlier in the call stack. See bug #345289. + os._exit(rval) -- 2.26.2