[oe-commits] [openembedded-core] 11/28: report-error.bbclass: Use with to control file handle lifetime
git at git.openembedded.org
git at git.openembedded.org
Tue Oct 22 12:58:50 UTC 2019
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 90fb05283c4c369568e569f268ed204257a70fdb
Author: Ola x Nilsson <ola.x.nilsson at axis.com>
AuthorDate: Mon Oct 21 12:30:31 2019 +0200
report-error.bbclass: Use with to control file handle lifetime
Signed-off-by: Ola x Nilsson <olani at axis.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/classes/report-error.bbclass | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index ea043b2..1a12db1 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -78,19 +78,15 @@ python errorreport_handler () {
taskdata['task'] = task
if log:
try:
- logFile = codecs.open(log, 'r', 'utf-8')
- logdata = logFile.read()
-
+ with codecs.open(log, encoding='utf-8') as logFile:
+ logdata = logFile.read()
# Replace host-specific paths so the logs are cleaner
for d in ("TOPDIR", "TMPDIR"):
s = e.data.getVar(d)
if s:
logdata = logdata.replace(s, d)
-
- logFile.close()
except:
logdata = "Unable to read log file"
-
else:
logdata = "No Log"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list