From 51cf37582369004218ab56657b13c43a046a1cb5 Mon Sep 17 00:00:00 2001 From: Reditus Date: Tue, 12 May 2026 04:34:39 +0100 Subject: [PATCH] Fix updater restart to use launcher script (preserves SSH/DB tunnels) --- app/services/updater.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/services/updater.py b/app/services/updater.py index 8e40f2e..d70a0b3 100644 --- a/app/services/updater.py +++ b/app/services/updater.py @@ -186,14 +186,20 @@ class UpdateService: return False, str(e) def _restart_app(self): - """Restart the dashboard process.""" + """Restart the dashboard via the launcher script to preserve SSH/DB tunnels.""" try: - # Find the running process and restart it - script = os.path.join(self.project_root, 'run.py') if os.name == 'nt': - subprocess.Popen([sys.executable, script], creationflags=subprocess.CREATE_NEW_CONSOLE) + launcher = os.path.join(self.project_root, 'start.bat') + if os.path.exists(launcher): + subprocess.Popen(['cmd', '/c', 'start', '', launcher], shell=True) + else: + subprocess.Popen([sys.executable, os.path.join(self.project_root, 'run.py')], creationflags=subprocess.CREATE_NEW_CONSOLE) else: - subprocess.Popen([sys.executable, script]) + launcher = os.path.join(self.project_root, 'start.sh') + if os.path.exists(launcher): + subprocess.Popen(['bash', launcher], start_new_session=True) + else: + subprocess.Popen([sys.executable, os.path.join(self.project_root, 'run.py')], start_new_session=True) os._exit(0) except Exception as e: logger.error(f"Restart failed: {e}")