Move out_buf in the try method

This commit is contained in:
Silversthorn 2021-09-25 23:08:40 +02:00
parent 05ced7610e
commit eee9796428

View File

@ -188,6 +188,7 @@ class Server:
servers_helper.set_waiting_start(self.server_id, False) servers_helper.set_waiting_start(self.server_id, False)
try: try:
self.process = pexpect.spawn(self.server_command, cwd=self.server_path, timeout=None, encoding='utf-8') self.process = pexpect.spawn(self.server_command, cwd=self.server_path, timeout=None, encoding='utf-8')
out_buf = ServerOutBuf(self.process, self.server_id)
except Exception as ex: except Exception as ex:
msg = "Server {} failed to start with error code: {}".format(self.name, ex) msg = "Server {} failed to start with error code: {}".format(self.name, ex)
logger.error(msg) logger.error(msg)
@ -209,8 +210,6 @@ class Server:
'error': translation.translate('error', 'internet') 'error': translation.translate('error', 'internet')
}) })
out_buf = ServerOutBuf(self.process, self.server_id)
logger.debug('Starting virtual terminal listener for server {}'.format(self.name)) logger.debug('Starting virtual terminal listener for server {}'.format(self.name))
threading.Thread(target=out_buf.check, daemon=True, name='{}_virtual_terminal'.format(self.server_id)).start() threading.Thread(target=out_buf.check, daemon=True, name='{}_virtual_terminal'.format(self.server_id)).start()