mirror of
https://github.com/lutris/lutris
synced 2024-10-14 19:53:53 +00:00
Make the pid list for a game stricter, so Stop doesn't get innocent processes.
We'll stop the game process (lutris-watcher, I think that is) and also any new process started since the game started, but those are counted only if they have the magic LUTRIS_GAME_UUID env var and also mention the game directory in the command line for the process. Resolves #5181
This commit is contained in:
parent
087e235c36
commit
f444a30a19
|
@ -794,18 +794,19 @@ class Game(GObject.Object):
|
|||
return set()
|
||||
|
||||
new_pids = self.get_new_pids()
|
||||
game_pids = []
|
||||
game_pids = set()
|
||||
game_folder = self.resolve_game_path()
|
||||
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.append(pid)
|
||||
game_pids.add(pid)
|
||||
|
||||
return set(game_pids + [
|
||||
game_pids.intersection_update(
|
||||
pid for pid in new_pids
|
||||
if Process(pid).environ.get("LUTRIS_GAME_UUID") == self.game_uuid
|
||||
])
|
||||
)
|
||||
return game_pids
|
||||
|
||||
def get_new_pids(self):
|
||||
"""Return list of PIDs started since the game was launched"""
|
||||
|
|
Loading…
Reference in a new issue