Skip to content

Commit 65d749c

Browse files
committed
Fix --exit-on-fail when installing custom node.
1 parent d50e501 commit 65d749c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

comfy_cli/command/custom_nodes/cm_cli_util.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222

2323

24-
def execute_cm_cli(args, channel=None, fast_deps=False, no_deps=False, mode=None) -> str | None:
24+
def execute_cm_cli(args, channel=None, fast_deps=False, no_deps=False, mode=None, raise_on_error=False) -> str | None:
2525
_config_manager = ConfigManager()
2626

2727
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
7070

7171
return result.stdout
7272
except subprocess.CalledProcessError as e:
73+
if raise_on_error:
74+
if e.stdout:
75+
print(e.stdout)
76+
if e.stderr:
77+
print(e.stderr, file=sys.stderr)
78+
raise e
79+
7380
if e.returncode == 1:
7481
print(f"\n[bold red]Execution error: {cmd}[/bold red]\n", file=sys.stderr)
7582
return None

comfy_cli/command/custom_nodes/command.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,11 @@ def install(
436436
else:
437437
cmd = ["install"] + nodes
438438

439-
execute_cm_cli(cmd, channel=channel, fast_deps=fast_deps, no_deps=no_deps, mode=mode)
439+
try:
440+
execute_cm_cli(cmd, channel=channel, fast_deps=fast_deps, no_deps=no_deps, mode=mode, raise_on_error=exit_on_fail)
441+
except subprocess.CalledProcessError as e:
442+
if exit_on_fail:
443+
raise typer.Exit(code=e.returncode)
440444

441445

442446
@app.command(help="Reinstall custom nodes")

0 commit comments

Comments
 (0)