From 806bb2ceee16cbfcc426ccedda006877895dae15 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 16 Nov 2023 14:24:13 +0100 Subject: [PATCH] Solved bug --- roles/update-docker/files/update-docker.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/update-docker/files/update-docker.py b/roles/update-docker/files/update-docker.py index b2b7096e..1e3d3cf9 100644 --- a/roles/update-docker/files/update-docker.py +++ b/roles/update-docker/files/update-docker.py @@ -4,15 +4,21 @@ import sys def run_command(command): process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - + output = [] + # Iterate over the output lines for line in iter(process.stdout.readline, b''): - sys.stdout.write(line.decode()) + decoded_line = line.decode() + output.append(decoded_line) + sys.stdout.write(decoded_line) process.stdout.close() return_code = process.wait() if return_code: - raise subprocess.CalledProcessError(return_code, command) + # Join the output list to create a single string + full_output = ''.join(output) + raise subprocess.CalledProcessError(return_code, command, output=full_output.encode()) + def git_pull(directory): os.chdir(directory)