From 2305928a00fe4d7b65a06b68156297de051101c6 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 4 Oct 2023 13:20:08 +0100 Subject: qemurunner: Skip conversion from/to binary data for logfile There is no point in decoding binary data only to encode it again risking conversion issues. Write the raw data to the log file as binary and skip the conversion. Also always update self.msg even if a logfile isn't specified to improve logging/debug. (From OE-Core rev: b5d67471dddd198723c4f711747783a33e8e5987) Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/qemurunner.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'meta/lib/oeqa/utils/qemurunner.py') diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 22cf258ddd..b8f5111286 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py @@ -115,10 +115,9 @@ class QemuRunner: def log(self, msg): if self.logfile: - msg = self.decode_qemulog(msg) - self.msg += msg - with codecs.open(self.logfile, "a", encoding="utf-8") as f: - f.write("%s" % msg) + with codecs.open(self.logfile, "ab") as f: + f.write(msg) + self.msg += self.decode_qemulog(msg) def getOutput(self, o): import fcntl -- cgit v1.2.3-54-g00ecf