diff --git a/__init__.py b/__init__.py index 334d799..64d6ac1 100644 --- a/__init__.py +++ b/__init__.py @@ -20,7 +20,7 @@ import nodes 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 '') 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: 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 "CUSTOM NODE PULL: True" in output: process.wait() @@ -1482,7 +1488,13 @@ async def update_comfyui(request): if 'detected dubious' in e: print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on 'ComfyUI' repository") 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 remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha diff --git a/prestartup_script.py b/prestartup_script.py index a227ff6..721cf85 100644 --- a/prestartup_script.py +++ b/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") git_script_path = os.path.join(comfyui_manager_path, "git_helper.py") +std_log_lock = threading.Lock() + class TerminalHook: def __init__(self): @@ -184,25 +186,27 @@ try: log_file.write(message) log_file.flush() - if self.is_stdout: - original_stdout.write(message) - original_stdout.flush() - terminal_hook.write_stderr(message) - else: - original_stderr.write(message) - original_stderr.flush() - terminal_hook.write_stdout(message) + with std_log_lock: + if self.is_stdout: + original_stdout.write(message) + original_stdout.flush() + terminal_hook.write_stderr(message) + else: + original_stderr.write(message) + original_stderr.flush() + terminal_hook.write_stdout(message) def flush(self): log_file.flush() - if self.is_stdout: - original_stdout.flush() - else: - original_stderr.flush() + + with std_log_lock: + if self.is_stdout: + original_stdout.flush() + else: + original_stderr.flush() def close(self): self.flush() - pass def reconfigure(self, *args, **kwargs): pass