mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-01-23 14:50:54 +01:00
Automatically restart webui if it stops/crashes
This commit is contained in:
parent
f51ab909ff
commit
4e3a5cb6d9
@ -69,8 +69,13 @@ def start_backend():
|
||||
global backend_process
|
||||
|
||||
cmd = "webui.bat" if platform.system() == "Windows" else "webui.sh"
|
||||
|
||||
while True:
|
||||
print("starting", cmd, WEBUI_DIR)
|
||||
backend_process = subprocess.Popen([cmd], shell=True, cwd=WEBUI_DIR, env=env)
|
||||
backend_process.wait()
|
||||
|
||||
stop_backend()
|
||||
|
||||
backend_thread = threading.Thread(target=target)
|
||||
backend_thread.start()
|
||||
@ -80,7 +85,10 @@ def stop_backend():
|
||||
global backend_process
|
||||
|
||||
if backend_process:
|
||||
try:
|
||||
kill(backend_process.pid)
|
||||
except:
|
||||
pass
|
||||
|
||||
backend_process = None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user