mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 18:05:26 +00:00
Fix: [ALAS] Handle psutil.NoSuchProcess
This commit is contained in:
parent
f02d6ad3af
commit
0a1c0e3dbd
@ -121,7 +121,10 @@ class DataProcessInfo:
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
try:
|
||||||
name = self.proc.name()
|
name = self.proc.name()
|
||||||
|
except:
|
||||||
|
name = ''
|
||||||
return name
|
return name
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
@ -130,6 +133,7 @@ class DataProcessInfo:
|
|||||||
cmdline = self.proc.cmdline()
|
cmdline = self.proc.cmdline()
|
||||||
except:
|
except:
|
||||||
# psutil.AccessDenied
|
# psutil.AccessDenied
|
||||||
|
# # NoSuchProcess: process no longer exists (pid=xxx)
|
||||||
cmdline = []
|
cmdline = []
|
||||||
cmdline = ' '.join(cmdline).replace(r'\\', '/').replace('\\', '/')
|
cmdline = ' '.join(cmdline).replace(r'\\', '/').replace('\\', '/')
|
||||||
return cmdline
|
return cmdline
|
||||||
|
@ -471,8 +471,9 @@ class EmulatorManager(EmulatorManagerBase):
|
|||||||
try:
|
try:
|
||||||
exe = proc.cmdline()
|
exe = proc.cmdline()
|
||||||
exe = exe[0].replace(r'\\', '/').replace('\\', '/')
|
exe = exe[0].replace(r'\\', '/').replace('\\', '/')
|
||||||
except (psutil.AccessDenied, IndexError):
|
except (psutil.AccessDenied, psutil.NoSuchProcess, IndexError):
|
||||||
# psutil.AccessDenied
|
# psutil.AccessDenied
|
||||||
|
# NoSuchProcess: process no longer exists (pid=xxx)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if Emulator.is_emulator(exe):
|
if Emulator.is_emulator(exe):
|
||||||
|
Loading…
Reference in New Issue
Block a user