From: Zac Medico Date: Tue, 11 Aug 2009 07:03:04 +0000 (-0000) Subject: Avoid using the wrapped os.read(), in order to avoid differing behavior X-Git-Tag: v2.2_rc39~113 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a7d784dcf8a160424dbd4d1a60622d384789c492;p=portage.git 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 --- 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