Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[610] Improved process_iter #2279

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading