From d47d7075e9e0939498c55a1856dddd11d8606c21 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Tue, 17 Nov 2026 02:13:29 +0900 Subject: [PATCH] change: move try statement to outer function --- dzgui/init/proc.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/dzgui/init/proc.py b/dzgui/init/proc.py index 483c8fe..ac1051c 100644 --- a/dzgui/init/proc.py +++ b/dzgui/init/proc.py @@ -31,12 +31,16 @@ def is_sandboxed() -> bool: return bool(os.environ.get("FLATPAK_ID")) -def get_flatpak_output() -> list[str]: - proc = subprocess.check_output( - [FLATPAK_CMD, "ps", "--columns=application"], text=True - ) - lines = proc.splitlines() - return lines +def get_flatpak_output() -> list[str] | None: + try: + proc = subprocess.check_output( + [FLATPAK_CMD, "ps", "--columns=application"], text=True + ) + lines = proc.splitlines() + return lines + except Exception as e: + logger.debug(e) + return None def is_flatpak_steam_running() -> bool: @@ -44,17 +48,12 @@ def is_flatpak_steam_running() -> bool: return True if has_cmd(FLATPAK_CMD) is False: return False - try: - proc = subprocess.check_output( - [FLATPAK_CMD, "ps", "--columns=application"], text=True - ) - lines = proc.splitlines() - if FLATPAK_APPID in lines: - return True - return False - except Exception as e: - logger.debug(e) + lines = get_flatpak_output() + if lines is None: return False + if FLATPAK_APPID in lines: + return True + return False def get_steam_procs() -> list[list[str]]: