1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 12:49:46 +00:00

report-error.bbclass: Use with to control file handle lifetime

(From OE-Core rev: ab108dfc690fb95b66f1c6243ff165f0849fa2b1)

Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ola x Nilsson
2019-10-21 12:30:31 +02:00
committed by Richard Purdie
parent f3f1597249
commit a92ef13e3d
+2 -6
View File
@@ -78,19 +78,15 @@ python errorreport_handler () {
taskdata['task'] = task taskdata['task'] = task
if log: if log:
try: try:
logFile = codecs.open(log, 'r', 'utf-8') with codecs.open(log, encoding='utf-8') as logFile:
logdata = logFile.read() logdata = logFile.read()
# Replace host-specific paths so the logs are cleaner # Replace host-specific paths so the logs are cleaner
for d in ("TOPDIR", "TMPDIR"): for d in ("TOPDIR", "TMPDIR"):
s = e.data.getVar(d) s = e.data.getVar(d)
if s: if s:
logdata = logdata.replace(s, d) logdata = logdata.replace(s, d)
logFile.close()
except: except:
logdata = "Unable to read log file" logdata = "Unable to read log file"
else: else:
logdata = "No Log" logdata = "No Log"