tests/lcitool/refresh: Treat the output of lcitool as text, not as bytes
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>
This commit is contained in:
parent
85ef20f167
commit
4d8698e692
@ -43,12 +43,12 @@ def atomic_write(filename, content):
|
|||||||
|
|
||||||
def generate(filename, cmd, trailer):
|
def generate(filename, cmd, trailer):
|
||||||
print("Generate %s" % filename)
|
print("Generate %s" % filename)
|
||||||
lcitool = subprocess.run(cmd, capture_output=True)
|
lcitool = subprocess.run(cmd, capture_output=True, encoding='utf8')
|
||||||
|
|
||||||
if lcitool.returncode != 0:
|
if lcitool.returncode != 0:
|
||||||
raise Exception("Failed to generate %s: %s" % (filename, lcitool.stderr))
|
raise Exception("Failed to generate %s: %s" % (filename, lcitool.stderr))
|
||||||
|
|
||||||
content = lcitool.stdout.decode("utf8")
|
content = lcitool.stdout
|
||||||
if trailer is not None:
|
if trailer is not None:
|
||||||
content += trailer
|
content += trailer
|
||||||
atomic_write(filename, content)
|
atomic_write(filename, content)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user