mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-02-02 19:49:15 +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
|
global backend_process
|
||||||
|
|
||||||
cmd = "webui.bat" if platform.system() == "Windows" else "webui.sh"
|
cmd = "webui.bat" if platform.system() == "Windows" else "webui.sh"
|
||||||
|
|
||||||
|
while True:
|
||||||
print("starting", cmd, WEBUI_DIR)
|
print("starting", cmd, WEBUI_DIR)
|
||||||
backend_process = subprocess.Popen([cmd], shell=True, cwd=WEBUI_DIR, env=env)
|
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 = threading.Thread(target=target)
|
||||||
backend_thread.start()
|
backend_thread.start()
|
||||||
@ -80,7 +85,10 @@ def stop_backend():
|
|||||||
global backend_process
|
global backend_process
|
||||||
|
|
||||||
if backend_process:
|
if backend_process:
|
||||||
|
try:
|
||||||
kill(backend_process.pid)
|
kill(backend_process.pid)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
backend_process = None
|
backend_process = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user