From 81f315e14d955d204f5b5495910dfc52087da172 Mon Sep 17 00:00:00 2001 From: bennykok Date: Wed, 27 Mar 2024 13:14:57 -0700 Subject: [PATCH] fix: clashes with ComfyUI manager restart --- prestartup_script.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/prestartup_script.py b/prestartup_script.py index a944d6d..c0fce00 100644 --- a/prestartup_script.py +++ b/prestartup_script.py @@ -58,6 +58,9 @@ if cd_enable_log: print("** Comfy Deploy logging enabled") setup() + +# Store the original working directory +original_cwd = os.getcwd() try: # Get the absolute path of the script's directory script_dir = os.path.dirname(os.path.abspath(__file__)) @@ -66,4 +69,7 @@ try: current_git_commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8').strip() print(f"** Comfy Deploy Revision: {current_git_commit}") except Exception as e: - print(f"** Comfy Deploy failed to get current git commit: {str(e)}") \ No newline at end of file + print(f"** Comfy Deploy failed to get current git commit: {str(e)}") +finally: + # Change back to the original directory + os.chdir(original_cwd) \ No newline at end of file