-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from Its-Haze/master
Additional detection for LeagueClientUx.exe to cover linux users.
- Loading branch information
Showing
1 changed file
with
13 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |