Skip to content

Commit

Permalink
Merge pull request #40 from Its-Haze/master
Browse files Browse the repository at this point in the history
Additional detection for LeagueClientUx.exe to cover linux users.
  • Loading branch information
sousa-andre authored Dec 20, 2023
2 parents 2c58d7b + a461d9f commit 5847a6d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lcu_driver/utils.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
from typing import Dict, Generator
from typing import Dict, Generator, List

from psutil import process_iter, Process, STATUS_ZOMBIE
from psutil import STATUS_ZOMBIE, Process, process_iter


def parse_cmdline_args(cmdline_args) -> Dict[str, str]:
cmdline_args_parsed = {}
for cmdline_arg in cmdline_args:
if len(cmdline_arg) > 0 and '=' in cmdline_arg:
key, value = cmdline_arg[2:].split('=', 1)
if len(cmdline_arg) > 0 and "=" in cmdline_arg:
key, value = cmdline_arg[2:].split("=", 1)
cmdline_args_parsed[key] = value
return cmdline_args_parsed


def _return_ux_process() -> Generator[Process, None, None]:
for process in process_iter():
for process in process_iter(attrs=["cmdline"]):
if process.status() == STATUS_ZOMBIE:
continue

if process.name() in ['LeagueClientUx.exe', 'LeagueClientUx']:
cmdline: List[str] = process.info.get("cmdline", [])

if process.name() in ["LeagueClientUx.exe", "LeagueClientUx"]:
yield process

# Check cmdline for the executable, especially useful in Linux environments
# where process names might differ due to compatibility layers like wine.
if cmdline and cmdline[0].endswith("LeagueClientUx.exe"):
yield process

0 comments on commit 5847a6d

Please sign in to comment.