about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-07-05 10:19:38 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-07-05 10:19:38 +0300
commitcc4ad0ca74ce80d42a4bc01d775c54ff8f2b845d (patch)
tree98709960bbeca0136105fabea7aac4bc8189604f
parenta578ef33d9ed4af19e54c8604e5c8b10ca399a14 (diff)
downloadfungus-launcher-cc4ad0ca74ce80d42a4bc01d775c54ff8f2b845d.tar.gz
fungus-launcher-cc4ad0ca74ce80d42a4bc01d775c54ff8f2b845d.tar.xz
stop passing (a bit) ugly dummy process around
-rw-r--r--fungus/game_launcher.py17
-rw-r--r--fungus/run_manager.py6
2 files changed, 14 insertions, 9 deletions
diff --git a/fungus/game_launcher.py b/fungus/game_launcher.py
index fb0806d..68efca6 100644
--- a/fungus/game_launcher.py
+++ b/fungus/game_launcher.py
@@ -38,9 +38,14 @@ log = get_logger(__name__)
 
 @dataclass
 class LaunchHandle:
-    """Handle for a launched process (for GLib watches)."""
+    """Handle for a launched process (for GLib watches).
 
-    process: subprocess.Popen
+    ``process`` is ``None`` when launch was skipped due to validation
+    failure (missing Steam Runtime, missing Proton, spawn error).  In
+    those cases the GTK adapter has already been notified via callbacks.
+    """
+
+    process: subprocess.Popen | None
     pid: int
 
 
@@ -366,7 +371,7 @@ class GameLauncher:
                 self._on_splash_close()
             if self._on_steam_runtime_missing:
                 self._on_steam_runtime_missing()
-            return LaunchHandle(subprocess.Popen([]), 0)  # dummy
+            return LaunchHandle(None, 0)
 
         if proton_dir and not self._check_proton_path():
             if not has_proton_installed():
@@ -374,13 +379,13 @@ class GameLauncher:
                     self._on_splash_close()
                 if self._on_proton_missing:
                     self._on_proton_missing()
-                return LaunchHandle(subprocess.Popen([]), 0)  # dummy
+                return LaunchHandle(None, 0)
 
             if self._on_splash_close:
                 self._on_splash_close()
             if self._on_proton_path_missing:
                 self._on_proton_path_missing(proton_dir)
-            return LaunchHandle(subprocess.Popen([]), 0)  # dummy
+            return LaunchHandle(None, 0)
 
         # ── Load env file ───────────────────────────────────────────
         self.env_from_file = self.load_env_from_file(envar_dir)
@@ -427,7 +432,7 @@ class GameLauncher:
             )
             if self._on_spawn_error:
                 self._on_spawn_error(error_msg)
-            return LaunchHandle(subprocess.Popen([]), 0)  # dummy
+            return LaunchHandle(None, 0)
 
         if self._on_process_started:
             self._on_process_started()
diff --git a/fungus/run_manager.py b/fungus/run_manager.py
index 03df048..e87e073 100644
--- a/fungus/run_manager.py
+++ b/fungus/run_manager.py
@@ -189,9 +189,9 @@ def handle_command(
 
     handle: LaunchHandle = launcher.start()
 
-    # If start() returned a dummy handle, validation failed — the
-    # appropriate error dialog is already shown via callbacks.
-    if handle.process and handle.process.stdout is not None:
+    # If start() returned a handle with process=None, validation failed —
+    # the appropriate error dialog is already shown via callbacks.
+    if handle.process is not None:
         # ── Attach GLib I/O watches ───────────────────────────────
         def make_io_handler(is_stderr: bool):
             """Create an I/O line handler for the given stream."""