[OE-core] [PATCH 03/28] oeqa.utils.commands: runCmd: gracefully handle empty output

Markus Lehtonen markus.lehtonen at linux.intel.com
Fri Jun 24 10:37:16 UTC 2016


Don't crash if the caller redirects the command output e.g. into a file,
causing the "output" seen by runCmd to be None.

Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
---
 meta/lib/oeqa/utils/commands.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 2e513be..171c64f 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -78,14 +78,15 @@ class Command(object):
                 self.process.kill()
                 self.thread.join()
 
-        self.output = self.output.decode("utf-8").rstrip()
+        if self.output:
+            self.output = self.output.decode("utf-8").rstrip()
         self.status = self.process.poll()
 
         self.log.debug("Command '%s' returned %d as exit code." % (self.cmd, self.status))
         # logging the complete output is insane
         # bitbake -e output is really big
         # and makes the log file useless
-        if self.status:
+        if self.status and self.output:
             lout = "\n".join(self.output.splitlines()[-20:])
             self.log.debug("Last 20 lines:\n%s" % lout)
 
-- 
2.6.6




More information about the Openembedded-core mailing list