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..d48331b5 100644 --- a/comfy_cli/command/custom_nodes/command.py +++ b/comfy_cli/command/custom_nodes/command.py @@ -436,7 +436,13 @@ 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")