From f2a04faf3c5d0a3cc562061b22e1c4873e1ca769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= Date: Wed, 27 Jul 2016 17:40:42 -0500 Subject: oeqa/utils/commands.py: Command class improve validations/decoding in output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Ross Burton --- meta/lib/oeqa/utils/commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'meta') diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 4f79d15bb8..a8e184d0c3 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)) -- cgit v1.2.3