Skip to contentSkip to conversation

lib/bb/utils: show subprocess output in stack traces

PATCH New Ross Burton 1 participant 1 message Jul 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/bb/utils: show subprocess output in stack traces

If better_exec() throws a subprocess.CalledProcessError then show the output to the user as it likely contains useful information for solving the problem.

---
 bitbake/lib/bb/utils.py | 6 ++++++
 1 file changed, 6 insertions(+)
bitbake/lib/bb/utils.py +6 -0
index 995089a..ce52960 100644
@@ -375,6 +375,12 @@ def _print_exception(t, value, tb, realfile, text, context):
             level = level + 1
 
         error.append("Exception: %s" % ''.join(exception))
+
+        # If the exception is from spwaning a task, let's be helpful and display
+        # the output (which hopefully includes stderr).
+        if isinstance(value, subprocess.CalledProcessError):
+            error.append("Subprocess output:")
+            error.append(value.output.decode("utf-8", errors="ignore"))
     finally:
         logger.error("\n".join(error))
 
Signature · 1 line
2.8.1