Browse Source

fix: display command instead of fixing.

pull/242/head
dr.lt.data 11 months ago
parent
commit
ffc19c0d07
  1. 16
      __init__.py
  2. 30
      prestartup_script.py

16
__init__.py

@ -20,7 +20,7 @@ import nodes
import torch import torch
version = [1, 13, 5] version = [1, 13, 6]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '') version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
print(f"### Loading: ComfyUI-Manager ({version_str})") print(f"### Loading: ComfyUI-Manager ({version_str})")
@ -316,6 +316,12 @@ def __win_check_git_update(path, do_fetch=False, do_update=False):
except Exception as e: except Exception as e:
print(f'[ComfyUI-Manager] failed to fixing') print(f'[ComfyUI-Manager] failed to fixing')
if 'detected dubious' in output:
print(f'\n[ComfyUI-Manager] Failed to fixing repository setup. Please execute this command on cmd: \n'
f'-----------------------------------------------------------------------------------------\n'
f'git config --global --add safe.directory "{path}"\n'
f'-----------------------------------------------------------------------------------------\n')
if do_update: if do_update:
if "CUSTOM NODE PULL: True" in output: if "CUSTOM NODE PULL: True" in output:
process.wait() process.wait()
@ -1482,7 +1488,13 @@ async def update_comfyui(request):
if 'detected dubious' in e: if 'detected dubious' in e:
print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on 'ComfyUI' repository") print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on 'ComfyUI' repository")
subprocess.run(['git', 'config', '--global', '--add', 'safe.directory', comfy_path]) subprocess.run(['git', 'config', '--global', '--add', 'safe.directory', comfy_path])
remote.fetch() try:
remote.fetch()
except Exception:
print(f"\n[ComfyUI-Manager] Failed to fixing repository setup. Please execute this command on cmd: \n"
f"-----------------------------------------------------------------------------------------\n"
f'git config --global --add safe.directory "{comfy_path}"\n'
f"-----------------------------------------------------------------------------------------\n")
commit_hash = repo.head.commit.hexsha commit_hash = repo.head.commit.hexsha
remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha

30
prestartup_script.py

@ -32,6 +32,8 @@ startup_script_path = os.path.join(comfyui_manager_path, "startup-scripts")
restore_snapshot_path = os.path.join(startup_script_path, "restore-snapshot.json") restore_snapshot_path = os.path.join(startup_script_path, "restore-snapshot.json")
git_script_path = os.path.join(comfyui_manager_path, "git_helper.py") git_script_path = os.path.join(comfyui_manager_path, "git_helper.py")
std_log_lock = threading.Lock()
class TerminalHook: class TerminalHook:
def __init__(self): def __init__(self):
@ -184,25 +186,27 @@ try:
log_file.write(message) log_file.write(message)
log_file.flush() log_file.flush()
if self.is_stdout: with std_log_lock:
original_stdout.write(message) if self.is_stdout:
original_stdout.flush() original_stdout.write(message)
terminal_hook.write_stderr(message) original_stdout.flush()
else: terminal_hook.write_stderr(message)
original_stderr.write(message) else:
original_stderr.flush() original_stderr.write(message)
terminal_hook.write_stdout(message) original_stderr.flush()
terminal_hook.write_stdout(message)
def flush(self): def flush(self):
log_file.flush() log_file.flush()
if self.is_stdout:
original_stdout.flush() with std_log_lock:
else: if self.is_stdout:
original_stderr.flush() original_stdout.flush()
else:
original_stderr.flush()
def close(self): def close(self):
self.flush() self.flush()
pass
def reconfigure(self, *args, **kwargs): def reconfigure(self, *args, **kwargs):
pass pass

Loading…
Cancel
Save