[Yum-devel] [PATCH] Use a tempfile instead of a pipe for scriplet errors, fixes BZ 465766
y at mail.and.org
y at mail.and.org
Tue Dec 22 20:17:35 UTC 2009
From: James Antill <james at and.org>
---
yum/rpmtrans.py | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index f20b1b8..cf0efeb 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -26,6 +26,7 @@ import sys
from yum.constants import *
from yum import _
import misc
+import tempfile
class NoOutputCallBack:
def __init__(self):
@@ -205,11 +206,10 @@ class RPMTransaction:
def _setupOutputLogging(self):
# UGLY... set up the transaction to record output from scriptlets
- (r, w) = os.pipe()
- # need fd objects, and read should be non-blocking
- self._readpipe = os.fdopen(r, 'r')
- self._fdSetNonblock(self._readpipe.fileno())
- self._writepipe = os.fdopen(w, 'w')
+ io_r = tempfile.TemporaryFile()
+ w = os.dup(io_r.fileno())
+ self._readpipe = io_r
+ self._writepipe = os.fdopen(w, 'w+b')
self.base.ts.scriptFd = self._writepipe.fileno()
rpm.setVerbosity(rpm.RPMLOG_INFO)
rpm.setLogFile(self._writepipe)
--
1.6.5.2
More information about the Yum-devel
mailing list