aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2016-07-27 17:40:42 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-01 11:46:37 +0100
commitf2a04faf3c5d0a3cc562061b22e1c4873e1ca769 (patch)
tree988a3d7e6b0b004f8adaf17b8c4ea3754d4eb37c
parentf49e4847ba00cdd072e5f072cb9ca69ef98af758 (diff)
downloadopenembedded-core-contrib-f2a04faf3c5d0a3cc562061b22e1c4873e1ca769.tar.gz
openembedded-core-contrib-f2a04faf3c5d0a3cc562061b22e1c4873e1ca769.tar.bz2
openembedded-core-contrib-f2a04faf3c5d0a3cc562061b22e1c4873e1ca769.zip
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] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--meta/lib/oeqa/utils/commands.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 4f79d15bb8e..a8e184d0c36 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -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))