aboutsummaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-02-03 14:20:12 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-03 14:29:56 +0000
commit787ffc5e12f1639aa5e0917bb23deced53a0478e (patch)
tree3095b1e1d66158f1bb480a80ce6c00835332b626 /meta
parent818bcba063819b80d5a99827c5adb8ee157dbfe1 (diff)
downloadopenembedded-core-contrib-787ffc5e12f1639aa5e0917bb23deced53a0478e.tar.gz
report-error: Catch un-readable log data
If a log data cannot be decoded to utf-8 or read then handle this gracefully. This can happen if a log file contains binary or something goes wrong with the file open process. Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/report-error.bbclass10
1 files changed, 7 insertions, 3 deletions
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 8b30422edf..5f155e332b 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -47,9 +47,13 @@ python errorreport_handler () {
taskdata['package'] = e.data.expand("${PF}")
taskdata['task'] = task
if log:
- logFile = open(log, 'r')
- taskdata['log'] = logFile.read()
- logFile.close()
+ try:
+ logFile = open(log, 'r')
+ taskdata['log'] = logFile.read().decode('utf-8')
+ logFile.close()
+ except:
+ taskdata['log'] = "Unable to read log file"
+
else:
taskdata['log'] = "No Log"
jsondata = json.loads(errorreport_getdata(e))