diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/report-error.bbclass | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass index ea043b23e1..1a12db1206 100644 --- a/meta/classes/report-error.bbclass +++ b/meta/classes/report-error.bbclass | |||
@@ -78,19 +78,15 @@ python errorreport_handler () { | |||
78 | taskdata['task'] = task | 78 | taskdata['task'] = task |
79 | if log: | 79 | if log: |
80 | try: | 80 | try: |
81 | logFile = codecs.open(log, 'r', 'utf-8') | 81 | with codecs.open(log, encoding='utf-8') as logFile: |
82 | logdata = logFile.read() | 82 | logdata = logFile.read() |
83 | |||
84 | # Replace host-specific paths so the logs are cleaner | 83 | # Replace host-specific paths so the logs are cleaner |
85 | for d in ("TOPDIR", "TMPDIR"): | 84 | for d in ("TOPDIR", "TMPDIR"): |
86 | s = e.data.getVar(d) | 85 | s = e.data.getVar(d) |
87 | if s: | 86 | if s: |
88 | logdata = logdata.replace(s, d) | 87 | logdata = logdata.replace(s, d) |
89 | |||
90 | logFile.close() | ||
91 | except: | 88 | except: |
92 | logdata = "Unable to read log file" | 89 | logdata = "Unable to read log file" |
93 | |||
94 | else: | 90 | else: |
95 | logdata = "No Log" | 91 | logdata = "No Log" |
96 | 92 | ||