Skip to contentSkip to conversation

event: Fix subprocess event error traceback failures

PATCH New Richard Purdie 1 participant 1 message Dec 9, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 event: Fix subprocess event error traceback failures

If subprocess raises a CalledProcessError() error, e.g. from a call like subprocess.check_call("false"), bitbake would try and pass the object over IPC and fail, leading to an unusual error:

('__init__() takes at least 3 arguments (1 given)', <class 'subprocess.CalledProcessError'>, ())%

To avoid this, we turn the value into a string which prevents the issues the IPC has trying to deal with the object (for the same reason we deal with tracebacks here too).

[YOCTO #8752]

---
 bitbake/lib/bb/event.py | 2 ++
 1 file changed, 2 insertions(+)
bitbake/lib/bb/event.py +2 -0
index 366bc41..ec25ce7 100644
@@ -595,6 +595,8 @@ class LogHandler(logging.Handler):
             etype, value, tb = record.exc_info
             if hasattr(tb, 'tb_next'):
                 tb = list(bb.exceptions.extract_traceback(tb, context=3))
+            # Need to turn the value into something the logging system can pickle
+            value = str(value)
             record.bb_exc_info = (etype, value, tb)
             record.exc_info = None
         fire(record, None)