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