mirror of
https://github.com/lutris/lutris
synced 2024-10-14 19:53:53 +00:00
No wait, & is more pythonic than intersection_update! Let's use that!
This commit is contained in:
parent
13c07bd378
commit
f4f9a12d47
|
@ -794,19 +794,20 @@ class Game(GObject.Object):
|
|||
return set()
|
||||
|
||||
new_pids = self.get_new_pids()
|
||||
game_pids = set()
|
||||
|
||||
game_folder = self.resolve_game_path()
|
||||
folder_pids = set()
|
||||
for pid in new_pids:
|
||||
cmdline = Process(pid).cmdline or ""
|
||||
# pressure-vessel: This could potentially pick up PIDs not started by lutris?
|
||||
if game_folder in cmdline or "pressure-vessel" in cmdline:
|
||||
game_pids.add(pid)
|
||||
folder_pids.add(pid)
|
||||
|
||||
game_pids.intersection_update(
|
||||
uuid_pids = set(
|
||||
pid for pid in new_pids
|
||||
if Process(pid).environ.get("LUTRIS_GAME_UUID") == self.game_uuid
|
||||
)
|
||||
return game_pids
|
||||
if Process(pid).environ.get("LUTRIS_GAME_UUID") == self.game_uuid)
|
||||
|
||||
return folder_pids & uuid_pids
|
||||
|
||||
def get_new_pids(self):
|
||||
"""Return list of PIDs started since the game was launched"""
|
||||
|
|
Loading…
Reference in a new issue