Fix: [ALAS] Handle psutil.NoSuchProcess

This commit is contained in:
LmeSzinc 2024-06-11 12:44:26 +08:00
parent f02d6ad3af
commit 0a1c0e3dbd
2 changed files with 7 additions and 2 deletions

View File

@ -121,7 +121,10 @@ class DataProcessInfo:
@cached_property
def name(self):
name = self.proc.name()
try:
name = self.proc.name()
except:
name = ''
return name
@cached_property
@ -130,6 +133,7 @@ class DataProcessInfo:
cmdline = self.proc.cmdline()
except:
# psutil.AccessDenied
# # NoSuchProcess: process no longer exists (pid=xxx)
cmdline = []
cmdline = ' '.join(cmdline).replace(r'\\', '/').replace('\\', '/')
return cmdline

View File

@ -471,8 +471,9 @@ class EmulatorManager(EmulatorManagerBase):
try:
exe = proc.cmdline()
exe = exe[0].replace(r'\\', '/').replace('\\', '/')
except (psutil.AccessDenied, IndexError):
except (psutil.AccessDenied, psutil.NoSuchProcess, IndexError):
# psutil.AccessDenied
# NoSuchProcess: process no longer exists (pid=xxx)
continue
if Emulator.is_emulator(exe):