Skip to content

Commit 7f42f0d

Browse files
authored
Merge pull request #46 from dcasota/upstream/tdnf-capture-output
tdnf: capture install output so it does not overlay the curses UI
2 parents 866b33d + f1b15dd commit 7f42f0d

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

photon_installer/tdnf.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,19 @@ def execute(self, args, do_json=True):
177177

178178
return retval, out_json
179179
else:
180-
return subprocess.check_call(args)
180+
# Capture output and route it to the log instead of inheriting the
181+
# parent's stdout/stderr. During a UI (curses) install the latter
182+
# overlays the progress bar with tdnf/rpm messages such as file
183+
# paths (e.g. /etc/os-release).
184+
process = subprocess.Popen(
185+
args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
186+
)
187+
for line in process.stdout:
188+
self.logger.info(line.decode('utf-8', errors='replace').rstrip())
189+
retval = process.wait()
190+
if retval != 0:
191+
raise subprocess.CalledProcessError(retval, args)
192+
return retval
181193

182194
def run(self, args=None, do_json=True):
183195
# Fix mutable default arguments issue

0 commit comments

Comments
 (0)