From b7ac1c7c22d4fdd93a678e6b36fd65e4257b0885 Mon Sep 17 00:00:00 2001 From: iice257 Date: Thu, 14 May 2026 08:38:58 +0100 Subject: [PATCH] fix: include deploy command output on failure --- src/algokit/cli/project/deploy.py | 10 +++++++++- ...test_deploy.test_command_bad_exit_code.approved.txt | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/algokit/cli/project/deploy.py b/src/algokit/cli/project/deploy.py index f07577667..0a0e8ddfb 100644 --- a/src/algokit/cli/project/deploy.py +++ b/src/algokit/cli/project/deploy.py @@ -17,6 +17,14 @@ logger = logging.getLogger(__name__) +def _format_deploy_error(result: proc.RunResult) -> str: + msg = f"Deployment command exited with error code = {result.exit_code}" + command_output = result.output.strip() + if command_output: + msg = f"{msg}\n\nCommand output:\n{command_output}" + return msg + + def _ensure_aliases( config_env: dict[str, str], deployer_alias: str | None = None, @@ -129,7 +137,7 @@ def _execute_deploy_command( # noqa: PLR0913 ) from ex else: if result.exit_code != 0: - raise click.ClickException(f"Deployment command exited with error code = {result.exit_code}") + raise click.ClickException(_format_deploy_error(result)) class _CommandParamType(click.types.StringParamType): diff --git a/tests/project/deploy/test_deploy.test_command_bad_exit_code.approved.txt b/tests/project/deploy/test_deploy.test_command_bad_exit_code.approved.txt index d1e5cf2f8..e475b7253 100644 --- a/tests/project/deploy/test_deploy.test_command_bad_exit_code.approved.txt +++ b/tests/project/deploy/test_deploy.test_command_bad_exit_code.approved.txt @@ -13,3 +13,6 @@ Deploying smart contracts from AlgoKit compliant repository 🚀 DEBUG: Running '/bin/gm' in '{current_working_directory}' /bin/gm: it is not morning Error: Deployment command exited with error code = -1 + +Command output: +it is not morning