mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-13 04:05:04 +03:00
Fix updater reload freezing (#786)
Builder Win / Build PluginLoader for Win (push) Has been cancelled
Builder / Build PluginLoader (push) Has been cancelled
Push Updated Plugin Stub to Template / copy-stub (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Type Check / Run type checkers (push) Has been cancelled
Builder Win / Build PluginLoader for Win (push) Has been cancelled
Builder / Build PluginLoader (push) Has been cancelled
Push Updated Plugin Stub to Template / copy-stub (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Type Check / Run type checkers (push) Has been cancelled
This commit is contained in:
@@ -11,7 +11,7 @@ logger = logging.getLogger("localplatform")
|
|||||||
# subprocess._ENV
|
# subprocess._ENV
|
||||||
ENV = Mapping[str, str]
|
ENV = Mapping[str, str]
|
||||||
ProcessIO = int | IO[Any] | None
|
ProcessIO = int | IO[Any] | None
|
||||||
async def run(args: list[str], stdin: ProcessIO = DEVNULL, stdout: ProcessIO = PIPE, stderr: ProcessIO = PIPE, env: ENV | None = None) -> tuple[Process, bytes | None, bytes | None]:
|
async def run(args: list[str], stdin: ProcessIO = DEVNULL, stdout: ProcessIO = PIPE, stderr: ProcessIO = PIPE, env: ENV | None = {"LD_LIBRARY_PATH": ""}) -> tuple[Process, bytes | None, bytes | None]:
|
||||||
proc = await create_subprocess_exec(args[0], *(args[1:]), stdin=stdin, stdout=stdout, stderr=stderr, env=env)
|
proc = await create_subprocess_exec(args[0], *(args[1:]), stdin=stdin, stdout=stdout, stderr=stderr, env=env)
|
||||||
proc_stdout, proc_stderr = await proc.communicate()
|
proc_stdout, proc_stderr = await proc.communicate()
|
||||||
return (proc, proc_stdout, proc_stderr)
|
return (proc, proc_stdout, proc_stderr)
|
||||||
@@ -146,6 +146,7 @@ async def service_active(service_name : str) -> bool:
|
|||||||
|
|
||||||
async def service_restart(service_name : str, block : bool = True) -> bool:
|
async def service_restart(service_name : str, block : bool = True) -> bool:
|
||||||
await run(["systemctl", "daemon-reload"])
|
await run(["systemctl", "daemon-reload"])
|
||||||
|
logger.info("Systemd reload done.")
|
||||||
cmd = ["systemctl", "restart", service_name]
|
cmd = ["systemctl", "restart", service_name]
|
||||||
|
|
||||||
if not block:
|
if not block:
|
||||||
@@ -272,7 +273,7 @@ async def close_cef_socket():
|
|||||||
logger.info(f"Closing CEF socket with PID {pid} and FD {fd}")
|
logger.info(f"Closing CEF socket with PID {pid} and FD {fd}")
|
||||||
|
|
||||||
# Use gdb to inject a close() call for the socket fd into steamwebhelper
|
# Use gdb to inject a close() call for the socket fd into steamwebhelper
|
||||||
gdb_ret, _, _ = await run(["gdb", "--nx", "-p", pid, "--batch", "--eval-command", f"call (int)close({fd})"], env={"LD_LIBRARY_PATH": ""})
|
gdb_ret, _, _ = await run(["gdb", "--nx", "-p", pid, "--batch", "--eval-command", f"call (int)close({fd})"])
|
||||||
|
|
||||||
if gdb_ret.returncode != 0:
|
if gdb_ret.returncode != 0:
|
||||||
logger.error(f"Failed to close CEF socket with gdb! return code: {str(gdb_ret.returncode)}", exc_info=True)
|
logger.error(f"Failed to close CEF socket with gdb! return code: {str(gdb_ret.returncode)}", exc_info=True)
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import zipfile
|
|||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
|
|
||||||
from . import helpers
|
from . import helpers
|
||||||
from .injector import get_gamepadui_tab
|
|
||||||
from .settings import SettingsManager
|
from .settings import SettingsManager
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .main import PluginManager
|
from .main import PluginManager
|
||||||
@@ -142,8 +141,6 @@ class Updater:
|
|||||||
async def download_decky_binary(self, download_url: str, version: str, is_zip: bool = False, size_in_bytes: int | None = None):
|
async def download_decky_binary(self, download_url: str, version: str, is_zip: bool = False, size_in_bytes: int | None = None):
|
||||||
download_filename = "PluginLoader" if ON_LINUX else "PluginLoader.exe"
|
download_filename = "PluginLoader" if ON_LINUX else "PluginLoader.exe"
|
||||||
download_temp_filename = download_filename + ".new"
|
download_temp_filename = download_filename + ".new"
|
||||||
tab = await get_gamepadui_tab()
|
|
||||||
await tab.open_websocket()
|
|
||||||
|
|
||||||
if size_in_bytes == None:
|
if size_in_bytes == None:
|
||||||
size_in_bytes = 26214400 # 25MiB, a reasonable overestimate (19.6MiB as of 2024/02/25)
|
size_in_bytes = 26214400 # 25MiB, a reasonable overestimate (19.6MiB as of 2024/02/25)
|
||||||
@@ -186,7 +183,6 @@ class Updater:
|
|||||||
|
|
||||||
logger.info("Updated loader installation.")
|
logger.info("Updated loader installation.")
|
||||||
await self.context.ws.emit("updater/finish_download")
|
await self.context.ws.emit("updater/finish_download")
|
||||||
await tab.close_websocket()
|
|
||||||
await self.do_restart()
|
await self.do_restart()
|
||||||
|
|
||||||
async def do_update(self):
|
async def do_update(self):
|
||||||
@@ -244,6 +240,7 @@ class Updater:
|
|||||||
await self.download_decky_binary(download_url, version, size_in_bytes=size_in_bytes)
|
await self.download_decky_binary(download_url, version, size_in_bytes=size_in_bytes)
|
||||||
|
|
||||||
async def do_restart(self):
|
async def do_restart(self):
|
||||||
|
logger.info("Restarting loader for update.")
|
||||||
await service_restart("plugin_loader", block=False)
|
await service_restart("plugin_loader", block=False)
|
||||||
|
|
||||||
async def do_shutdown(self):
|
async def do_shutdown(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user