From 4d8698e692cca96bbf20505a90e42d10141d2b94 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Thu, 16 May 2024 10:40:55 +0200 Subject: [PATCH] tests/lcitool/refresh: Treat the output of lcitool as text, not as bytes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In case lcitool fails (e.g. with a python backtrace), this makes the output of lcitool much more readable. Suggested-by: Daniel P. Berrangé Message-ID: <20240516084059.511463-2-thuth@redhat.com> Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- tests/lcitool/refresh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh index 24a735a3f2..174818d9c9 100755 --- a/tests/lcitool/refresh +++ b/tests/lcitool/refresh @@ -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)