From ca4089626e9434cf07a3fdf5de99934488bccd08 Mon Sep 17 00:00:00 2001 From: Nerivec <62446222+Nerivec@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:09:49 +0100 Subject: [PATCH] Update feedback. --- tools/build_project.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/build_project.py b/tools/build_project.py index 5bf81cbf..385766c1 100755 --- a/tools/build_project.py +++ b/tools/build_project.py @@ -170,16 +170,14 @@ def load_toolchains(paths: list[pathlib.Path]) -> dict[pathlib.Path, str]: def subprocess_run_verbose(command: list[str], prefix: str) -> None: - result = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - - with result.stdout: - for line in iter(result.stdout.readline, b""): + with subprocess.Popen( + command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) as proc: + for line in proc.stdout: LOGGER.info("[%s] %r", prefix, line.decode("utf-8").strip()) - result_returncode = result.wait() - - if result_returncode != 0: - LOGGER.error("[%s] Error: %s", prefix, result_returncode) + if proc.returncode != 0: + LOGGER.error("[%s] Error: %s", prefix, proc.returncode) sys.exit(1)