留一个退出后清理的逻辑,虽然windows上用不了

This commit is contained in:
2022-06-05 22:39:19 +08:00
parent dc1800e492
commit 788c8cba9d
3 changed files with 32 additions and 11 deletions

10
main.py
View File

@ -1,5 +1,6 @@
import threading
import subprocess
import atexit
from config.helper import config
from handler.http_server import app
@ -15,5 +16,14 @@ if __name__ == '__main__':
api_thread.start()
browser_manager = init_browser_manager()
output_manager = OutputManager()
def terminate():
print("terminate")
browser_manager.terminate()
output_manager.terminate()
atexit.register(terminate)
output_manager.start_loop()
api_thread.join()