mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-13 17:29:21 +08:00
Fix: FileNotFoundError wasn't handled
This commit is contained in:
@@ -87,18 +87,17 @@ class LDConsole:
|
|||||||
cmd = [self.ld_console] + cmd
|
cmd = [self.ld_console] + cmd
|
||||||
logger.info(f'Execute: {cmd}')
|
logger.info(f'Execute: {cmd}')
|
||||||
|
|
||||||
|
try:
|
||||||
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=False)
|
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=False)
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
logger.warning(f'warning when calling {cmd}, {str(e)}')
|
||||||
|
raise LDOpenGLIncompatible(f'ld_folder does not have ldconsole.exe')
|
||||||
try:
|
try:
|
||||||
stdout, stderr = process.communicate(timeout=timeout)
|
stdout, stderr = process.communicate(timeout=timeout)
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
process.kill()
|
process.kill()
|
||||||
stdout, stderr = process.communicate()
|
stdout, stderr = process.communicate()
|
||||||
logger.warning(f'TimeoutExpired when calling {cmd}, stdout={stdout}, stderr={stderr}')
|
logger.warning(f'TimeoutExpired when calling {cmd}, stdout={stdout}, stderr={stderr}')
|
||||||
except FileNotFoundError:
|
|
||||||
process.kill()
|
|
||||||
stdout, stderr = process.communicate()
|
|
||||||
logger.warning(f'warning when calling {cmd}, stdout={stdout}, stderr={stderr}')
|
|
||||||
raise LDOpenGLIncompatible(f'ld_folder does not have ldconsole.exe')
|
|
||||||
return stdout
|
return stdout
|
||||||
|
|
||||||
def list2(self) -> t.List[DataLDPlayerInfo]:
|
def list2(self) -> t.List[DataLDPlayerInfo]:
|
||||||
@@ -299,7 +298,7 @@ class LDOpenGL(Platform):
|
|||||||
# with E:/ProgramFiles/LDPlayer9/dnplayer.exe
|
# with E:/ProgramFiles/LDPlayer9/dnplayer.exe
|
||||||
# installation path is E:/ProgramFiles/LDPlayer9
|
# installation path is E:/ProgramFiles/LDPlayer9
|
||||||
if self.emulator_instance is None:
|
if self.emulator_instance is None:
|
||||||
logger.error('Unable to use NemuIpc because emulator instance not found')
|
logger.error('Unable to use LDOpenGL because emulator instance not found')
|
||||||
raise RequestHumanTakeover
|
raise RequestHumanTakeover
|
||||||
try:
|
try:
|
||||||
return LDOpenGLImpl(
|
return LDOpenGLImpl(
|
||||||
@@ -308,7 +307,7 @@ class LDOpenGL(Platform):
|
|||||||
)
|
)
|
||||||
except (LDOpenGLIncompatible, LDOpenGLError) as e:
|
except (LDOpenGLIncompatible, LDOpenGLError) as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
logger.error('Unable to initialize NemuIpc')
|
logger.error('Unable to initialize LDOpenGL')
|
||||||
raise RequestHumanTakeover
|
raise RequestHumanTakeover
|
||||||
|
|
||||||
def ldopengl_available(self) -> bool:
|
def ldopengl_available(self) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user