From 3d1f8b9445d89400e7278c6523849d1687008f07 Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Mon, 30 Jan 2012 17:24:15 +0800 Subject: [PATCH] Always disable logstderr and flush message buffer in disable_logstderr --- mic/msger.py | 1 + plugins/backend/yumpkgmgr.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mic/msger.py b/mic/msger.py index 5f02c29..f3780e4 100644 --- a/mic/msger.py +++ b/mic/msger.py @@ -269,6 +269,7 @@ def disable_logstderr(): global CATCHERR_BUFFILE_PATH global CATCHERR_SAVED_2 + raw(msg = None) # flush message buffer and print it. os.dup2(CATCHERR_SAVED_2, 2) os.close(CATCHERR_SAVED_2) os.close(CATCHERR_BUFFILE_FD) diff --git a/plugins/backend/yumpkgmgr.py b/plugins/backend/yumpkgmgr.py index 9a259b8..ed6732b 100644 --- a/plugins/backend/yumpkgmgr.py +++ b/plugins/backend/yumpkgmgr.py @@ -332,16 +332,16 @@ class Yum(BackendPlugin, yum.YumBase): msger.warning('\nCaution, do NOT interrupt the installation, else mic cannot finish the cleanup.') installlogfile = "%s/__catched_stderr.buf" % (self.instroot) msger.enable_logstderr(installlogfile) - ret = self.runTransaction(cb) + self.runTransaction(cb) self._cleanupRpmdbLocks(self.conf.installroot) - msger.disable_logstderr() - return ret except rpmUtils.RpmUtilsError, e: raise CreatorError("mic does NOT support delta rpm: %s" % e) except yum.Errors.RepoError, e: raise CreatorError("Unable to download from repo : %s" % e) except yum.Errors.YumBaseError, e: raise CreatorError("Unable to install: %s" % e) + finally: + msger.disable_logstderr() def getAllContent(self): return self.__pkgs_content -- 2.7.4