[oe-commits] [openembedded-core] 05/08: oeqa/utils/commands.py: Command class improve validations/decoding in output

git at git.openembedded.org git at git.openembedded.org
Thu Jul 28 21:43:12 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 93944f6e7704fc008f8b8eafa13d4647db6d85cc
Author: Aníbal Limón <anibal.limon at linux.intel.com>
AuthorDate: Wed Jul 27 17:40:42 2016 -0500

    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 at linux.intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/lib/oeqa/utils/commands.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 4f79d15..a8e184d 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))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list