mirror of
https://git.yoctoproject.org/poky
synced 2026-04-17 09:32:12 +02:00
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
(From OE-Core rev: 17e87510378f2729208a8262695f28e1efe5eb4c)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user