MergeProcess: handle unicode in elog pipe
authorZac Medico <zmedico@gentoo.org>
Fri, 25 Mar 2011 20:52:16 +0000 (13:52 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 25 Mar 2011 20:52:16 +0000 (13:52 -0700)
pym/portage/dbapi/_MergeProcess.py
pym/portage/dbapi/vartree.py

index 5caeef372c544e207aee2411bdcd746dd9efd02b..b5c45b36d8baa45d8dec1f8a3241eaf7acba40f7 100644 (file)
@@ -7,7 +7,7 @@ import traceback
 import errno
 import fcntl
 import portage
-from portage import os, StringIO
+from portage import os, StringIO, _unicode_decode
 import portage.elog.messages
 from _emerge.PollConstants import PollConstants
 from _emerge.SpawnProcess import SpawnProcess
@@ -32,7 +32,7 @@ class MergeProcess(SpawnProcess):
                                if e.errno not in (errno.EAGAIN, errno.EINTR):
                                        raise
                if output:
-                       lines = output.split('\n')
+                       lines = _unicode_decode(output).split('\n')
                        if len(lines) == 1:
                                self._buf += lines[0]
                        else:
index 0e60af82a5e8288c21d26f3a86ac4e93cfa3427f..d463c3a5e58d88f0b710cd17e64725815b3a6c9e 100644 (file)
@@ -2802,7 +2802,7 @@ class dblink(object):
                                                buffer.append(' '.join(fields))
                                                buffer.append('\n')
                        if buffer:
-                               os.write(self._pipe, ''.join(buffer))
+                               os.write(self._pipe, _unicode_encode(''.join(buffer)))
 
        def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0,
                mydbapi=None, prev_mtimes=None):