Solver: Add error message when command executable do not exists.

results
Pierre-Antoine Rouby 2023-08-04 11:20:15 +02:00
parent 464209b6e5
commit 61f31403d4
2 changed files with 25 additions and 3 deletions

View File

@ -193,6 +193,11 @@ class AbstractSolver(object):
exe = cmd[0]
args = cmd[1:]
if not os.path.exists(exe):
error = f"[ERROR] Path {exe} do not exists"
logger.info(error)
return error
self._process.start(
exe, args,
)
@ -216,6 +221,11 @@ class AbstractSolver(object):
exe = cmd[0]
args = cmd[1:]
if not os.path.exists(exe):
error = f"[ERROR] Path {exe} do not exists"
logger.info(error)
return error
self._process.start(
exe, args,
)
@ -240,6 +250,11 @@ class AbstractSolver(object):
exe = cmd[0]
args = cmd[1:]
if not os.path.exists(exe):
error = f"[ERROR] Path {exe} do not exists"
logger.info(error)
return error
self._process.start(
exe, args,
)
@ -255,7 +270,9 @@ class AbstractSolver(object):
def _run_next(self):
self._step += 1
if self._step < len(self._runs):
self._runs[self._step]()
res = self._runs[self._step]()
if res is not True:
self._output.put(res)
else:
self._status = STATUS.STOPED
@ -281,7 +298,9 @@ class AbstractSolver(object):
]
self._step = 0
# Run first step
self._runs[0]()
res = self._runs[0]()
if res is not True:
self._output.put(res)
def kill(self):
if self._process is None:

View File

@ -198,7 +198,10 @@ class SolverLogWindow(ASubMainWindow, ListedSubWindow):
while self._output.qsize() != 0:
s = self._output.get()
self._log(s)
if type(s) is str and "[ERROR]" in s:
self._log(s, color="red")
else:
self._log(s)
def start(self):
if self._solver.is_stoped():