summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-01 08:00:00 +0100
committerArmin Kuster <akuster808@gmail.com>2019-05-11 08:32:01 -0700
commit918e15e22c797d52d33c3399324e480aa1a2cc7f (patch)
tree76263b32820c19e38e92b6ce036cd46e40748cf8
parent5979289d5f306d37fe5c8ed994bb833f2492ef32 (diff)
downloadopenembedded-core-918e15e22c797d52d33c3399324e480aa1a2cc7f.tar.gz
oeqa/ssh: Avoid unicode decode exceptions
This code really needs to be rewritten to not split potential multibyte characters, for now work around it to avoid exceptions like: File "/home/pokybuild/yocto-worker/qa-extras2/build/meta/lib/oeqa/core/target/ssh.py", line 211, in run data = reader.read(1024, 4096) File "/usr/lib64/python3.6/codecs.py", line 503, in read newchars, decodedbytes = self.decode(data, self.errors) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 0: invalid start byte Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta/lib/oeqa/core/target/ssh.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
index 8ff1f6c677..2adbb3000c 100644
--- a/meta/lib/oeqa/core/target/ssh.py
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -207,7 +207,7 @@ def SSHCall(command, logger, timeout=None, **opts):
logger.debug('time: %s, endtime: %s' % (time.time(), endtime))
try:
if select.select([process.stdout], [], [], 5)[0] != []:
- reader = codecs.getreader('utf-8')(process.stdout)
+ reader = codecs.getreader('utf-8')(process.stdout, 'surrogatepass')
data = reader.read(1024, 4096)
if not data:
process.stdout.close()
@@ -234,7 +234,7 @@ def SSHCall(command, logger, timeout=None, **opts):
output += lastline
else:
- output = process.communicate()[0].decode("utf-8", errors='replace')
+ output = process.communicate()[0].decode("utf-8", errors='surrogatepass')
logger.debug('Data from SSH call: %s' % output.rstrip())
options = {