summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/utils
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-05-04 16:06:25 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-14 23:05:14 +0100
commita173885ccfcff1099fa47c0f84913d14ac26079f (patch)
tree600eb12497ebeecec135fd2f182533d4f9bb0a68 /scripts/lib/wic/utils
parent5f06463c6c23f337147457dd9e490887ac194db4 (diff)
downloadpoky-a173885ccfcff1099fa47c0f84913d14ac26079f.tar.gz
wic: decode output of subprocess.communicate
stdeout and stderr content returned by communicate API has different types in Python 3(bytes) and Python 2(string). Decoding it to 'utf-8' makes it unicode on both pythons. Decoded stdout and stderr output to utf-8 to make the code working under both Python 2 and Python 3. (From OE-Core rev: 5b556f58a171e3d45107bb56a1f780e5c1abba37) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/utils')
-rw-r--r--scripts/lib/wic/utils/runner.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/lib/wic/utils/runner.py b/scripts/lib/wic/utils/runner.py
index 737751bd73..db536ba588 100644
--- a/scripts/lib/wic/utils/runner.py
+++ b/scripts/lib/wic/utils/runner.py
@@ -65,8 +65,8 @@ def runtool(cmdln_or_args, catch=1):
65 process = subprocess.Popen(cmdln_or_args, stdout=sout, 65 process = subprocess.Popen(cmdln_or_args, stdout=sout,
66 stderr=serr, shell=shell) 66 stderr=serr, shell=shell)
67 (sout, serr) = process.communicate() 67 (sout, serr) = process.communicate()
68 # combine stdout and stderr, filter None out 68 # combine stdout and stderr, filter None out and decode
69 out = ''.join(filter(None, [sout, serr])) 69 out = ''.join([out.decode('utf-8') for out in [sout, serr] if out])
70 except OSError as err: 70 except OSError as err:
71 if err.errno == 2: 71 if err.errno == 2:
72 # [Errno 2] No such file or directory 72 # [Errno 2] No such file or directory