diff --git a/webhook_server_container/libs/github_api.py b/webhook_server_container/libs/github_api.py index 4ccb21d4..8419e580 100644 --- a/webhook_server_container/libs/github_api.py +++ b/webhook_server_container/libs/github_api.py @@ -2017,6 +2017,7 @@ def fix_podman_bug(self) -> None: def run_podman_command(self, command: str, pipe: bool = False) -> Tuple[bool, str, str]: rc, out, err = run_command(command=command, log_prefix=self.log_prefix, pipe=pipe) + if rc: return rc, out, err diff --git a/webhook_server_container/utils/helpers.py b/webhook_server_container/utils/helpers.py index 8a624cc5..433c94b0 100644 --- a/webhook_server_container/utils/helpers.py +++ b/webhook_server_container/utils/helpers.py @@ -71,7 +71,7 @@ def run_command( check: bool = False, pipe: bool = False, **kwargs: Any, -) -> Tuple[bool, str, str]: +) -> Tuple[bool, Any, Any]: """ Run command locally. @@ -111,8 +111,12 @@ def run_command( timeout=timeout, **kwargs, ) - out_decoded = sub_process.stdout.decode() if isinstance(sub_process.stdout, bytes) else sub_process.stdout - err_decoded = sub_process.stderr.decode() if isinstance(sub_process.stderr, bytes) else sub_process.stderr + out_decoded = ( + sub_process.stdout.decode(errors="ignore") if isinstance(sub_process.stdout, bytes) else sub_process.stdout + ) + err_decoded = ( + sub_process.stderr.decode(errors="ignore") if isinstance(sub_process.stderr, bytes) else sub_process.stderr + ) error_msg = ( f"{log_prefix} Failed to run '{command}'. "