Skip to content

Commit

Permalink
Merge pull request #2279 from HullSeals/enhancement/610/improved-proc…
Browse files Browse the repository at this point in the history
…ess-iter

[610] Improved process_iter
  • Loading branch information
Rixxan authored Aug 13, 2024
2 parents c5d48bb + 1e9dec1 commit 4857361
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2156,12 +2156,11 @@ def game_running(self) -> bool:
# Process likely expired
self.running_process = None
if not self.running_process:
edmc_process = psutil.Process()
edmc_user = edmc_process.username()
try:
for pid in psutil.pids():
proc = psutil.Process(pid)
if 'EliteDangerous' in proc.name() and proc.username() == edmc_user:
edmc_process = psutil.Process()
edmc_user = edmc_process.username()
for proc in psutil.process_iter(['name', 'username']):
if 'EliteDangerous' in proc.info['name'] and proc.info['username'] == edmc_user:
self.running_process = proc
return True
except psutil.NoSuchProcess:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ simplesystray==0.1.0; sys_platform == 'win32'
semantic-version==2.10.0
# For manipulating folder permissions and the like.
pywin32==306; sys_platform == 'win32'
psutil==5.9.8
psutil==6.0.0

0 comments on commit 4857361

Please sign in to comment.