]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
qemurunner: Skip conversion from/to binary data for logfile
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 4 Oct 2023 12:20:08 +0000 (13:20 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 4 Oct 2023 22:05:45 +0000 (23:05 +0100)
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/qemurunner.py

index 22cf258dddf6c456fb00206c3034b46b64cf3082..b8f51112861e1e58ec56c8564cdfbe01ff315943 100644 (file)
@@ -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