1
0
mirror of https://github.com/lutris/lutris synced 2024-07-05 16:38:42 +00:00

Adapt winekill for umu

This commit is contained in:
Mathieu Comandon 2024-03-25 16:43:43 -07:00
parent 676beb0495
commit 74ff7899c4
2 changed files with 18 additions and 15 deletions

View File

@ -177,22 +177,22 @@ def winekill(prefix, arch=WINE_DEFAULT_ARCH, wine_path=None, env=None, initial_p
"""Kill processes in Wine prefix."""
initial_pids = initial_pids or []
if not wine_path:
if not runner:
runner = import_runner("wine")()
wine_path = runner.get_executable()
wine_root = os.path.dirname(wine_path)
if not env:
env = {"WINEARCH": arch, "WINEPREFIX": prefix}
command = [os.path.join(wine_root, "wineserver"), "-k"]
logger.debug("Killing all wine processes: %s", command)
logger.debug("\tWine prefix: %s", prefix)
logger.debug("\tWine arch: %s", arch)
if initial_pids:
logger.debug("\tInitial pids: %s", initial_pids)
env = {"WINEARCH": arch, "WINEPREFIX": prefix}
if proton.is_proton_path(wine_path):
command = [proton.get_umu_path(), "runinprefix", "wineboot", "-e"]
env["GAMEID"] = proton.DEFAULT_GAMEID
else:
if not wine_path:
if not runner:
runner = import_runner("wine")()
wine_path = runner.get_executable()
wine_root = os.path.dirname(wine_path)
command = [os.path.join(wine_root, "wineserver"), "-k"]
logger.debug("Killing all wine processes (%s) in prefix %s: %s", initial_pids, prefix, command)
logger.debug(command)
logger.debug(" ".join(command))
system.execute(command, env=env, quiet=True)
logger.debug("Waiting for wine processes to terminate")

View File

@ -933,6 +933,7 @@ class wine(Runner):
def run_winekill(self, *args):
"""Runs wineserver -k."""
winekill(
self.prefix_path,
arch=self.wine_arch,
@ -1147,7 +1148,9 @@ class wine(Runner):
exe = wine_path or self.get_executable()
except MisconfigurationError:
return set()
if proton.is_proton_path(exe):
logger.debug("Tracking PIDs of Proton games is not possible at the moment")
return set()
if not exe.startswith("/"):
exe = system.find_required_executable(exe)
pids = system.get_pids_using_file(exe)