From 65d749c5081af3e1683ce93083512285b4c2e7a2 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 11 Sep 2025 19:18:19 -0700 Subject: [PATCH 1/2] Fix --exit-on-fail when installing custom node. --- comfy_cli/command/custom_nodes/cm_cli_util.py | 9 ++++++++- comfy_cli/command/custom_nodes/command.py | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/comfy_cli/command/custom_nodes/cm_cli_util.py b/comfy_cli/command/custom_nodes/cm_cli_util.py index 7d487b38..347313cf 100644 --- a/comfy_cli/command/custom_nodes/cm_cli_util.py +++ b/comfy_cli/command/custom_nodes/cm_cli_util.py @@ -21,7 +21,7 @@ } -def execute_cm_cli(args, channel=None, fast_deps=False, no_deps=False, mode=None) -> str | None: +def execute_cm_cli(args, channel=None, fast_deps=False, no_deps=False, mode=None, raise_on_error=False) -> str | None: _config_manager = ConfigManager() workspace_path = workspace_manager.workspace_path @@ -70,6 +70,13 @@ def execute_cm_cli(args, channel=None, fast_deps=False, no_deps=False, mode=None return result.stdout except subprocess.CalledProcessError as e: + if raise_on_error: + if e.stdout: + print(e.stdout) + if e.stderr: + print(e.stderr, file=sys.stderr) + raise e + if e.returncode == 1: print(f"\n[bold red]Execution error: {cmd}[/bold red]\n", file=sys.stderr) return None diff --git a/comfy_cli/command/custom_nodes/command.py b/comfy_cli/command/custom_nodes/command.py index 42f3b11c..33d1e68c 100644 --- a/comfy_cli/command/custom_nodes/command.py +++ b/comfy_cli/command/custom_nodes/command.py @@ -436,7 +436,11 @@ def install( else: cmd = ["install"] + nodes - execute_cm_cli(cmd, channel=channel, fast_deps=fast_deps, no_deps=no_deps, mode=mode) + try: + execute_cm_cli(cmd, channel=channel, fast_deps=fast_deps, no_deps=no_deps, mode=mode, raise_on_error=exit_on_fail) + except subprocess.CalledProcessError as e: + if exit_on_fail: + raise typer.Exit(code=e.returncode) @app.command(help="Reinstall custom nodes") From d4593b7b963e1dce0393fcd86ab5069976ce6c0c Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 11 Sep 2025 19:33:53 -0700 Subject: [PATCH 2/2] Format. --- comfy_cli/command/custom_nodes/command.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/comfy_cli/command/custom_nodes/command.py b/comfy_cli/command/custom_nodes/command.py index 33d1e68c..d48331b5 100644 --- a/comfy_cli/command/custom_nodes/command.py +++ b/comfy_cli/command/custom_nodes/command.py @@ -437,7 +437,9 @@ def install( cmd = ["install"] + nodes try: - execute_cm_cli(cmd, channel=channel, fast_deps=fast_deps, no_deps=no_deps, mode=mode, raise_on_error=exit_on_fail) + execute_cm_cli( + cmd, channel=channel, fast_deps=fast_deps, no_deps=no_deps, mode=mode, raise_on_error=exit_on_fail + ) except subprocess.CalledProcessError as e: if exit_on_fail: raise typer.Exit(code=e.returncode)