summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-09-23 18:08:03 +0000
committerZac Medico <zmedico@gentoo.org>2007-09-23 18:08:03 +0000
commit417386003fa43fb02d49b2c09e5012bfb8114568 (patch)
tree3593733b7ce4b36ec8c0d976b215b518909373b1 /pym
parent7c27bcd86c26d821952ea9c16189f95e376a71dc (diff)
downloadportage-417386003fa43fb02d49b2c09e5012bfb8114568.tar.gz
portage-417386003fa43fb02d49b2c09e5012bfb8114568.tar.bz2
portage-417386003fa43fb02d49b2c09e5012bfb8114568.zip
In spawn(), initialize default fd_pipes before doing the stdout/stderr flush.
svn path=/main/trunk/; revision=7796
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 271e11669..d4411a7fc 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2385,14 +2385,16 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
env=mysettings.environ()
keywords["opt_name"]="[%s]" % mysettings["PF"]
+ fd_pipes = keywords.get("fd_pipes")
+ if fd_pipes is None:
+ fd_pipes = {0:0, 1:1, 2:2}
# In some cases the above print statements don't flush stdout, so
# it needs to be flushed before allowing a child process to use it
# so that output always shows in the correct order.
- fd_pipes = keywords.get("fd_pipes")
- if fd_pipes:
- if fd_pipes.get(1) == sys.stdout.fileno():
+ for fd in fd_pipes.itervalues():
+ if fd == sys.stdout.fileno():
sys.stdout.flush()
- if fd_pipes.get(2) == sys.stderr.fileno():
+ if fd == sys.stderr.fileno():
sys.stderr.flush()
# The default policy for the sesandbox domain only allows entry (via exec)
@@ -2408,10 +2410,7 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
got_pty = False
if logfile:
del keywords["logfile"]
- fd_pipes = keywords.get("fd_pipes")
- if fd_pipes is None:
- fd_pipes = {0:0, 1:1, 2:2}
- elif 1 not in fd_pipes or 2 not in fd_pipes:
+ if 1 not in fd_pipes or 2 not in fd_pipes:
raise ValueError(fd_pipes)
from pty import openpty
try: