change: move try statement to outer function

This commit is contained in:
aclist committed 2026-11-17 02:13:29 +09:00
1 parent ea41503dad
commit d47d7075e9
1 file changed
+15 -16
+15 -16
View File
@@ -31,12 +31,16 @@ def is_sandboxed() -> bool:
return bool(os.environ.get("FLATPAK_ID")) return bool(os.environ.get("FLATPAK_ID"))
def get_flatpak_output() -> list[str]: def get_flatpak_output() -> list[str] | None:
proc = subprocess.check_output( try:
[FLATPAK_CMD, "ps", "--columns=application"], text=True proc = subprocess.check_output(
) [FLATPAK_CMD, "ps", "--columns=application"], text=True
lines = proc.splitlines() )
return lines lines = proc.splitlines()
return lines
except Exception as e:
logger.debug(e)
return None
def is_flatpak_steam_running() -> bool: def is_flatpak_steam_running() -> bool:
@@ -44,17 +48,12 @@ def is_flatpak_steam_running() -> bool:
return True return True
if has_cmd(FLATPAK_CMD) is False: if has_cmd(FLATPAK_CMD) is False:
return False return False
try: lines = get_flatpak_output()
proc = subprocess.check_output( if lines is None:
[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)
return False return False
if FLATPAK_APPID in lines:
return True
return False
def get_steam_procs() -> list[list[str]]: def get_steam_procs() -> list[list[str]]: