From a16c7ac16e28d690260e46444dd49f2924c2ca14 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 9 Apr 2026 09:34:25 +0200 Subject: [PATCH] installer auto-restart on upgrade Signed-off-by: vladmandic --- CHANGELOG.md | 1 + installer.py | 5 +++-- launch.py | 13 +++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a1a0a18d..6a050673e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ now covers both ROCm on Windows and Linux see *main interface -> scripts -> rocm advanced config* - **Features** + - installer auto-restart on upgrade - enhanced filename pattern processing allows for any *processing* property name (as defined in `modules/processing_class.py` and saved to `ui-config.json`) allows for any *settings* property name (as defined in `modules/ui_definitions.py` and saved to `config.json`) diff --git a/installer.py b/installer.py index bb9aa0349..2c269ce9b 100644 --- a/installer.py +++ b/installer.py @@ -352,9 +352,10 @@ def branch(folder=None): # restart process -def restart(): +def restart(argv: list | None = None): + argv = argv if isinstance(argv, list) else sys.argv log.critical('Restarting process...') - os.execv(sys.executable, ['python'] + sys.argv) + os.execv(sys.executable, ['python'] + argv) # update git repository diff --git a/launch.py b/launch.py index 2629a96cb..e1c191f31 100755 --- a/launch.py +++ b/launch.py @@ -303,9 +303,18 @@ def main(): get_custom_args() installer.update_wiki() + if args.upgrade: + if installer.restart_required: + log.warning('Installer: restarting now to apply upgrade...') + if '--upgrade' in sys.argv: + sys.argv.remove('--upgrade') + if '--update' in sys.argv: + sys.argv.remove('--update') + installer.restart(sys.argv) + else: + log.debug('Installer: no modifications') + uv, instance = start_server(immediate=True, server=None) - if installer.restart_required: - log.warning('Restart is recommended due to packages updates...') t_server = time.time() t_monitor = time.time()