commit:     c6d2400dccc2b5334bfab5f82f1a8bf1ab38f06c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 14 18:04:53 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Feb 14 18:09:43 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c6d2400d

revdep-rebuild: encode Popen args as utf-8 bytes (bug 709610)

Prevent this Popen exception:

UnicodeEncodeError: 'ascii' codec can't encode character '\xe8' in position 20: 
ordinal not in range(128)

Bug: https://bugs.gentoo.org/709610#c0
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 pym/gentoolkit/revdep_rebuild/stuff.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/gentoolkit/revdep_rebuild/stuff.py 
b/pym/gentoolkit/revdep_rebuild/stuff.py
index 3b0a980..002eb4b 100644
--- a/pym/gentoolkit/revdep_rebuild/stuff.py
+++ b/pym/gentoolkit/revdep_rebuild/stuff.py
@@ -19,6 +19,7 @@ def call_program(args):
        @param, args: arument list to pass to subprocess
        @return str
        '''
+       args = [arg if isinstance(arg, bytes) else arg.encode('utf-8') for arg 
in args]
        subp = subprocess.Popen(args, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
        stdout, stderr = subp.communicate()
        stdout = stdout.decode('utf-8')

Reply via email to