1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 17:19:20 +00:00

oeqa/utils/commands.py: Command class improve validations/decoding in output

When run a command sometimes the output isn't provided so validate
before trying to encode to utf-8, also some output like BIOS/EFI
contains characters that can't be codified into utf-8 for this reason
set errors='replace'.

[YOCTO #10019]

(From OE-Core rev: f2a04faf3c5d0a3cc562061b22e1c4873e1ca769)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Aníbal Limón
2016-07-27 17:40:42 -05:00
committed by Richard Purdie
parent 1648504198
commit 1981ab0829
+4 -1
View File
@@ -78,7 +78,10 @@ class Command(object):
self.process.kill()
self.thread.join()
self.output = self.output.decode("utf-8").rstrip()
if not self.output:
self.output = ""
else:
self.output = self.output.decode("utf-8", errors='replace').rstrip()
self.status = self.process.poll()
self.log.debug("Command '%s' returned %d as exit code." % (self.cmd, self.status))