]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/utils/commands.py: Command class improve validations/decoding in output
authorAníbal Limón <anibal.limon@linux.intel.com>
Wed, 27 Jul 2016 22:40:42 +0000 (17:40 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 1 Aug 2016 10:46:37 +0000 (11:46 +0100)
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>
meta/lib/oeqa/utils/commands.py

index 4f79d15bb8efc2e331d1ee664eeb0d5d64a955b3..a8e184d0c3602d525996752dda70bd19a382ddf0 100644 (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))