Skip to content

Commit d395906

Browse files
committed
fix(git_helper): duplicate error summary to stdout for reliable capture
execute_cm_cli() in comfy-cli captures stdout via PIPE but may not capture stderr (depends on comfy-cli version). Add stdout echo of error summary at clone failure and dispatch-level exception so comfy-cli always has access to git_helper error details. Diagnostic logs remain on stderr; stdout gets a one-line summary with repo name, exit code, and git error message.
1 parent 6f83e42 commit d395906

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

comfyui_manager/common/git_helper.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,14 @@ def gitclone(custom_nodes_path, url, target_hash=None, repo_path=None):
131131
repo = git.Repo.clone_from(url, repo_path, recursive=True, progress=progress)
132132
except git.GitCommandError as clone_err:
133133
dir_exists_after = os.path.exists(repo_path)
134+
# Diagnostic detail on stderr
134135
print(f"[git_helper] clone FAILED: exit_code={clone_err.status} "
135136
f"dir_exists_after={dir_exists_after}", file=sys.stderr)
136137
if clone_err.stderr:
137138
print(f"[git_helper] git stderr: {clone_err.stderr.strip()}", file=sys.stderr)
139+
# Error summary on stdout (always captured by comfy-cli execute_cm_cli)
140+
git_msg = clone_err.stderr.strip() if clone_err.stderr else ''
141+
print(f"[git_helper] clone FAILED: {repo_name} exit_code={clone_err.status} {git_msg}")
138142
raise
139143

140144
if target_hash is not None:
@@ -592,11 +596,16 @@ def setup_environment():
592596
restore_pip_snapshot(pips, options)
593597
sys.exit(0)
594598
except Exception as e:
599+
# Diagnostic detail on stderr
595600
print(f"[git_helper] ERROR: {type(e).__name__}: {e}", file=sys.stderr)
596601
if hasattr(e, 'stderr') and e.stderr:
597602
print(f"[git_helper] git stderr: {e.stderr.strip()}", file=sys.stderr)
598603
if hasattr(e, 'status'):
599604
print(f"[git_helper] exit_code: {e.status}", file=sys.stderr)
605+
# Error summary on stdout (always captured by comfy-cli execute_cm_cli)
606+
git_stderr = e.stderr.strip() if hasattr(e, 'stderr') and e.stderr else ''
607+
exit_code = e.status if hasattr(e, 'status') else 'N/A'
608+
print(f"[git_helper] ERROR: {type(e).__name__} exit_code={exit_code} {git_stderr}")
600609
sys.exit(1)
601610

602611

0 commit comments

Comments
 (0)