tests/lcitool/refresh: Treat the output of lcitool as text, not as bytes
authorThomas Huth <thuth@redhat.com>
Thu, 16 May 2024 08:40:55 +0000 (10:40 +0200)
committerThomas Huth <thuth@redhat.com>
Fri, 17 May 2024 09:15:58 +0000 (11:15 +0200)
In case lcitool fails (e.g. with a python backtrace), this makes
the output  of lcitool much more readable.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20240516084059.511463-2-thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/lcitool/refresh

index 24a735a3f22bbf7074542163b66b0acb6c199f68..174818d9c9b917f0a8a807abe6e1b17cf37224c0 100755 (executable)
@@ -43,12 +43,12 @@ def atomic_write(filename, content):
 
 def generate(filename, cmd, trailer):
     print("Generate %s" % filename)
-    lcitool = subprocess.run(cmd, capture_output=True)
+    lcitool = subprocess.run(cmd, capture_output=True, encoding='utf8')
 
     if lcitool.returncode != 0:
         raise Exception("Failed to generate %s: %s" % (filename, lcitool.stderr))
 
-    content = lcitool.stdout.decode("utf8")
+    content = lcitool.stdout
     if trailer is not None:
         content += trailer
     atomic_write(filename, content)