mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-12-24 03:58:32 -08:00
Merge pull request #10975 from AUTOMATIC1111/restart3
A yet another method to restart webui.
This commit is contained in:
@@ -244,6 +244,12 @@ def prepare_environment():
|
||||
codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
|
||||
blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
|
||||
|
||||
try:
|
||||
# the existance of this file is a signal to webui.sh/bat that webui needs to be restarted when it stops execution
|
||||
os.remove(os.path.join(script_path, "tmp", "restart"))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
if not args.skip_python_version_check:
|
||||
check_python_version()
|
||||
|
||||
|
||||
@@ -852,3 +852,12 @@ def walk_files(path, allowed_extensions=None):
|
||||
continue
|
||||
|
||||
yield os.path.join(root, filename)
|
||||
|
||||
|
||||
def restart_program():
|
||||
"""creates file tmp/restart and immediately stops the process, which webui.bat/webui.sh interpret as a command to start webui again"""
|
||||
|
||||
with open(os.path.join(script_path, "tmp", "restart"), "w"):
|
||||
pass
|
||||
|
||||
os._exit(0)
|
||||
|
||||
@@ -49,7 +49,7 @@ def apply_and_restart(disable_list, update_list, disable_all):
|
||||
shared.opts.disabled_extensions = disabled
|
||||
shared.opts.disable_all_extensions = disable_all
|
||||
shared.opts.save(shared.config_filename)
|
||||
shared.state.request_restart()
|
||||
shared.restart_program()
|
||||
|
||||
|
||||
def save_config_state(name):
|
||||
|
||||
Reference in New Issue
Block a user