diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-06-27 06:02:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-27 06:02:38 +0000 |
commit | 58a9a261c4feb729717c386fea70f8ea985c6722 (patch) | |
tree | ebc822c17a889034672297d7450477f7c945cbb7 /modules/restart.py | |
parent | 373ff5a217eca33607abb692b9ebfa38abb7fe33 (diff) | |
parent | 2c43dd766da52d2ccaaa78d8f265a6a4aa33b9df (diff) | |
download | stable-diffusion-webui-gfx803-58a9a261c4feb729717c386fea70f8ea985c6722.tar.gz stable-diffusion-webui-gfx803-58a9a261c4feb729717c386fea70f8ea985c6722.tar.bz2 stable-diffusion-webui-gfx803-58a9a261c4feb729717c386fea70f8ea985c6722.zip |
Merge branch 'dev' into meta_class
Diffstat (limited to 'modules/restart.py')
-rw-r--r-- | modules/restart.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/modules/restart.py b/modules/restart.py new file mode 100644 index 00000000..18eacaf3 --- /dev/null +++ b/modules/restart.py @@ -0,0 +1,23 @@ +import os +from pathlib import Path + +from modules.paths_internal import script_path + + +def is_restartable() -> bool: + """ + Return True if the webui is restartable (i.e. there is something watching to restart it with) + """ + return bool(os.environ.get('SD_WEBUI_RESTART')) + + +def restart_program() -> None: + """creates file tmp/restart and immediately stops the process, which webui.bat/webui.sh interpret as a command to start webui again""" + + (Path(script_path) / "tmp" / "restart").touch() + + stop_program() + + +def stop_program() -> None: + os._exit(0) |