fix: Erkennung von bereits laufendem Server und dessen beendung. incl. Tests
This commit is contained in:
1 parent
1519b96c7b
commit
971459c9bf
8 files changed
+420
-169
No files matched your search
@@ -76,6 +76,8 @@ except ImportError:
|
||||
# ── Data Files ──────────────────────────────────────────────────
|
||||
datas = [
|
||||
(str(_APP_DIR / "app.py"), "."),
|
||||
(str(_APP_DIR / "version_check.py"), "."),
|
||||
(str(_APP_DIR / "CHANGELOG.md"), "."),
|
||||
(str(_APP_DIR / "src"), "src"),
|
||||
(str(_APP_DIR / "config"), "config"),
|
||||
]
|
||||
|
||||
@@ -12,12 +12,17 @@ Dieses Skript:
|
||||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import webbrowser
|
||||
from pathlib import Path
|
||||
|
||||
if not getattr(sys, "frozen", False):
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "0_application"))
|
||||
from server_lifecycle import stop_existing_server
|
||||
|
||||
|
||||
def _get_base_dir() -> Path:
|
||||
"""Verzeichnis der .exe (bzw. des Skripts im Entwicklungsmodus)."""
|
||||
@@ -44,6 +49,14 @@ def _ensure_dirs(base_dir: Path) -> None:
|
||||
|
||||
|
||||
def main() -> None:
|
||||
# Only open the browser/start Streamlit once the previous server has stopped.
|
||||
try:
|
||||
if not stop_existing_server():
|
||||
print("[INFO] Die bisherige Version bleibt geöffnet. Keine neue Instanz gestartet.")
|
||||
return
|
||||
except (RuntimeError, OSError, subprocess.SubprocessError) as exc:
|
||||
print(f"[FEHLER] Server-Neustart fehlgeschlagen: {exc}", file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
base_dir = _get_base_dir()
|
||||
|
||||
# Im gebundelten Modus: sys._MEIPASS enthält src/ und app.py
|
||||
|
||||
Reference in new issue
Block a user