在代码同步功能中添加 2 秒的等待时间,以确保程序平稳重启
This commit is contained in:
2
main.py
2
main.py
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user