Browse Source

!2 try to fix restart game

pcacc 2 tháng trước cách đây
mục cha
commit
333c77073e
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      app_dongri.py

+ 3 - 1
app_dongri.py

@@ -169,7 +169,8 @@ def handle_reset_script():
 @socketio.on('restart_game')
 def handle_restart_game():
     python = sys.executable
-    os.execl(python, python, *sys.argv, '--reset')
+    subprocess.Popen([python, *sys.argv, '--reset'])
+    os._exit(0)
 
 @app.route('/restart_game', methods=['POST'])
 def http_restart_game():
@@ -622,6 +623,7 @@ def handle_auto_palace():
 if __name__ == '__main__':
     init()
     if '--reset' in sys.argv:
+        time.sleep(1)
         isReset = True
         print("需要重启游戏")
     runTask = threading.Thread(target=thread_runTask)#启动线程往里面添加任务