From a7d784dcf8a160424dbd4d1a60622d384789c492 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 11 Aug 2009 07:03:04 +0000 Subject: 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 --- pym/portage/__init__.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'pym') 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 -- cgit v1.2.3-1-g7c22