Added Try Catch around server job spawn. This fixes bug where crafty would not gracefully handle if java did not exist.

This commit is contained in:
Andrew McManus 2021-07-30 10:30:58 -04:00
parent feab08b36f
commit c2a673dfc3

View File

@ -137,7 +137,11 @@ class Server:
logger.info("Linux Detected")
logger.info("Starting server in {p} with command: {c}".format(p=self.server_path, c=self.server_command))
try:
self.process = pexpect.spawn(self.server_command, cwd=self.server_path, timeout=None, encoding=None)
except Exception as ex:
logger.error("Server {} failed to start with error code: {}".format(self.name, ex))
return False
self.is_crashed = False
ts = time.time()