Pass a SIGTERM to tell the uvicorn server to exit and gracefully kill the thread

This commit is contained in:
sabaimran 2023-08-16 21:23:59 -07:00
parent 34d5cd2bd8
commit 4fb8c2c5e1
2 changed files with 7 additions and 1 deletions

View file

@ -1,5 +1,7 @@
# Standard Packages
import webbrowser
import os
import signal
# External Packages
from PySide6 import QtGui, QtWidgets
@ -21,6 +23,10 @@ class ServerThread(QThread):
def run(self):
self.start_server_func()
def exit(self):
os.kill(os.getpid(), signal.SIGTERM)
super(ServerThread, self).exit()
class MainWindow(QtWidgets.QMainWindow):
"""Create Window to Navigate users to the web UI"""

View file

@ -123,7 +123,7 @@ def run():
# Start Application
server.start()
gui.aboutToQuit.connect(server.terminate)
gui.aboutToQuit.connect(server.exit)
# Close Splash Screen if still open
if system() != "Darwin":