Revert "Avoid to crash on unicode decoding errors"

This reverts commit 7d8f3b4b9b. It
doesn't really fix the problem. A better fix follows.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Adam Williamson 2025-01-15 16:19:57 -08:00 committed by Lubomír Sedlář
parent 3d5348a672
commit 98e3b3f8c4
2 changed files with 42 additions and 88 deletions

View file

@ -16,7 +16,6 @@
import os
import json
import subprocess
from kobo import shortcuts
from pungi.util import makedirs
@ -60,19 +59,13 @@ class Tree(OSTree):
# permissions. See https://pagure.io/releng/issue/8811#comment-629051
oldumask = os.umask(0o0002)
try:
with open(log_file, "w") as f:
f.write(f"COMMAND: {' '.join(cmd)}\n")
f.flush()
proc = subprocess.Popen(
cmd,
shell=True,
stdout=f,
stderr=subprocess.STDOUT,
universal_newlines=True,
)
ret_code = proc.wait()
if ret_code:
raise RuntimeError(f"Failed to run rpm-ostree, log_file: {log_file}")
shortcuts.run(
cmd,
show_cmd=True,
stdout=True,
logfile=log_file,
universal_newlines=True,
)
finally:
os.umask(oldumask)