在代码同步功能中添加 2 秒的等待时间,以确保程序平稳重启

This commit is contained in:
2025-04-08 22:35:34 +08:00
Unverified
parent a474253912
commit be8038d398

View File

@@ -82,10 +82,12 @@ def pseudo_zsh():
if args[0] == 'update':
try:
print("Updating code...")
subprocess.run(['git', 'pull'])
subprocess.run(['git', 'push'])
print("Code synchronized successfully.")
print("Restarting the program...")
time.sleep(2) # 等待 2 秒
os.execv(sys.executable, ['python3'] + sys.argv) # 重新运行程序
except Exception as e:
print(f"Error during update: {e}")