[prev in list] [next in list] [prev in thread] [next in thread]
List: openembedded-core
Subject: [OE-core] [PATCH] report-error: Catch un-readable log data
From: michael.g.wood () intel ! com (Michael Wood)
Date: 2015-01-30 11:57:45
Message-ID: 1422619065-28018-1-git-send-email-michael.g.wood () intel ! com
[Download RAW message or body]
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 read process.
Signed-off-by: Michael Wood <michael.g.wood at intel.com>
---
meta/classes/report-error.bbclass | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 8b30422..750042b 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -48,7 +48,11 @@ python errorreport_handler () {
taskdata['task'] = task
if log:
logFile = open(log, 'r')
- taskdata['log'] = logFile.read()
+ try:
+ taskdata['log'] = logFile.read().decode('utf-8')
+ except:
+ taskdata['log'] = "Unable to read log file"
+
logFile.close()
else:
taskdata['log'] = "No Log"
--
2.1.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic