From 8f541ff0c44444c4581eaaa82afb30498fd7a9f1 Mon Sep 17 00:00:00 2001 From: tretrauit Date: Sun, 27 Feb 2022 13:36:57 +0700 Subject: [PATCH] Wait for patch process to exit Bump to 1.2.9-2 --- setup.py | 2 +- worthless/linux.py | 1 + worthless/patcher.py | 23 +++++++++++++++-------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index b061b9d..5b93ae6 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text() setup( name='worthless', - version='1.2.9-1', + version='1.2.9-2', packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'], url='https://git.froggi.es/tretrauit/worthless-launcher', license='MIT License', diff --git a/worthless/linux.py b/worthless/linux.py index 08bddd0..817162b 100644 --- a/worthless/linux.py +++ b/worthless/linux.py @@ -12,6 +12,7 @@ class LinuxUtils: """Execute a command using pkexec (friendly gui) """ rsp = await asyncio.create_subprocess_exec(*args) + await rsp.wait() match rsp.returncode: case 127: raise OSError("Authentication failed.") diff --git a/worthless/patcher.py b/worthless/patcher.py index 1e31dfa..fb16e85 100644 --- a/worthless/patcher.py +++ b/worthless/patcher.py @@ -147,9 +147,12 @@ class Patcher: gamever = "".join(self._installer.get_game_version().split(".")) unity_path = self._gamedir.joinpath("UnityPlayer.dll") unity_path.rename(self._gamedir.joinpath("UnityPlayer.dll.bak")) - await asyncio.create_subprocess_exec("xdelta3", "-d", "-s", str(self._gamedir.joinpath("UnityPlayer.dll.bak")), - str(self._patch_path.joinpath("{}/patch_files/{}".format(gamever, patch))), - str(self._gamedir.joinpath("UnityPlayer.dll")), cwd=self._gamedir) + proc = await asyncio.create_subprocess_exec("xdelta3", "-d", "-s", + str(self._gamedir.joinpath("UnityPlayer.dll.bak")), + str(self._patch_path.joinpath( + "{}/patch_files/{}".format(gamever, patch))), + str(self._gamedir.joinpath("UnityPlayer.dll")), cwd=self._gamedir) + await proc.wait() async def _patch_xlua_fallback(self): # xdelta3-python doesn't work becuase it's outdated. @@ -161,11 +164,15 @@ class Patcher: data_name = self._installer.get_game_data_name() xlua_path = self._gamedir.joinpath("{}/Plugins/xlua.dll".format(data_name)) xlua_path.rename(self._gamedir.joinpath("{}/Plugins/xlua.dll.bak".format(data_name))) - await asyncio.create_subprocess_exec("xdelta3", "-d", "-s", - str(self._gamedir.joinpath("{}/Plugins/xlua.dll.bak".format(data_name))), - str(self._patch_path.joinpath("{}/patch_files/{}".format(gamever, patch))), - str(self._gamedir.joinpath("{}/Plugins/xlua.dll".format(data_name))), - cwd=self._gamedir) + proc = await asyncio.create_subprocess_exec("xdelta3", "-d", "-s", + str(self._gamedir.joinpath( + "{}/Plugins/xlua.dll.bak".format(data_name))), + str(self._patch_path.joinpath( + "{}/patch_files/{}".format(gamever, patch))), + str(self._gamedir.joinpath( + "{}/Plugins/xlua.dll".format(data_name))), + cwd=self._gamedir) + await proc.wait() def _patch_unityplayer(self): if self._overseas: