diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-02-03 14:20:12 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-02-03 14:30:55 +0000 |
commit | bd84192866af85c6ef8a5653547c67bb813f14a4 (patch) | |
tree | 45f2de45007c991ca3ec83bd23fd9ceaa3b6e8cd /meta/classes/report-error.bbclass | |
parent | 013f7e286d72c51b52a72fdbff6cbc875b3a15ac (diff) | |
download | poky-bd84192866af85c6ef8a5653547c67bb813f14a4.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.
(From OE-Core rev: 787ffc5e12f1639aa5e0917bb23deced53a0478e)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/report-error.bbclass')
-rw-r--r-- | meta/classes/report-error.bbclass | 10 |
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 () { | |||
47 | taskdata['package'] = e.data.expand("${PF}") | 47 | taskdata['package'] = e.data.expand("${PF}") |
48 | taskdata['task'] = task | 48 | taskdata['task'] = task |
49 | if log: | 49 | if log: |
50 | logFile = open(log, 'r') | 50 | try: |
51 | taskdata['log'] = logFile.read() | 51 | logFile = open(log, 'r') |
52 | logFile.close() | 52 | taskdata['log'] = logFile.read().decode('utf-8') |
53 | logFile.close() | ||
54 | except: | ||
55 | taskdata['log'] = "Unable to read log file" | ||
56 | |||
53 | else: | 57 | else: |
54 | taskdata['log'] = "No Log" | 58 | taskdata['log'] = "No Log" |
55 | jsondata = json.loads(errorreport_getdata(e)) | 59 | jsondata = json.loads(errorreport_getdata(e)) |