diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-08-11 07:03:04 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-08-11 07:03:04 +0000 |
commit | a7d784dcf8a160424dbd4d1a60622d384789c492 (patch) | |
tree | 46c66029f8b9be77f1a81dbd9924ca1ffe0bbedf | |
parent | 01833ee25f0af4e4d74f2e2969a7786306f8ae21 (diff) | |
download | portage-a7d784dcf8a160424dbd4d1a60622d384789c492.tar.gz portage-a7d784dcf8a160424dbd4d1a60622d384789c492.tar.bz2 portage-a7d784dcf8a160424dbd4d1a60622d384789c492.zip |
Avoid using the wrapped os.read(), in order to avoid differing behavior
between python-2.x (with wrapper) and py3k (without wrapper). This sort
of mismatch only applies to os functions that return raw bytes under py3k,
rather than unicode.
svn path=/main/trunk/; revision=13992
-rw-r--r-- | pym/portage/__init__.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index cb6958e95..7c829e96c 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -6168,16 +6168,11 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, mysettings, fd_pipes=fd_pipes, returnpid=True, droppriv=droppriv) os.close(pw) # belongs exclusively to the child process now - maxbytes = 1024 - mybytes = [] - while True: - mybytes.append(os.read(pr, maxbytes)) - if not mybytes[-1]: - break - os.close(pr) - global auxdbkeys - for k, v in izip(auxdbkeys, ''.join(mybytes).splitlines()): + f = os.fdopen(pr, 'rb') + for k, v in izip(auxdbkeys, + (_unicode_decode(line).rstrip('\n') for line in f)): dbkey[k] = v + f.close() retval = os.waitpid(mypids[0], 0)[1] portage.process.spawned_pids.remove(mypids[0]) # If it got a signal, return the signal that was sent, but |