Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] terminal.py: Pass string instead of bytes to ExecutionError to avoid exception
@ 2016-11-27 20:02 Martin Vuille
  0 siblings, 0 replies; only message in thread
From: Martin Vuille @ 2016-11-27 20:02 UTC (permalink / raw)
  To: openembedded-core

Based on run() in bitbake/lib/bb/process.py, ExecutionError() expects strings
not bytes. Passing bytes results in a "TypeError: Can't convert 'bytes' object
to str implicitly" exception.

Fixes Bug 10729

Signed-off-by: Martin Vuille <jpmv27@yahoo.com>
---
 meta/lib/oe/terminal.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 3901ad3..3c8ef59 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -227,6 +227,8 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
 
     pipe = terminal(sh_cmd, title, env, d)
     output = pipe.communicate()[0]
+    if output:
+        output = output.decode("utf-8")
     if pipe.returncode != 0:
         raise ExecutionError(sh_cmd, pipe.returncode, output)
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-27 20:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-27 20:02 [PATCH] terminal.py: Pass string instead of bytes to ExecutionError to avoid exception Martin Vuille

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox