This commit is contained in:
simon987 2023-02-23 19:53:05 -05:00
parent b17f3ff924
commit 8b9b067c06

View File

@ -277,23 +277,17 @@ class Sist2:
@staticmethod @staticmethod
def _consume_logs_stdout(logs_cb, proc): def _consume_logs_stdout(logs_cb, proc):
pipe_wrapper = TextIOWrapper(proc.stdout, encoding="utf8", errors="ignore") pipe_wrapper = TextIOWrapper(proc.stdout, encoding="utf8", errors="ignore")
try: for line in pipe_wrapper:
for line in pipe_wrapper: try:
if line.strip() == "": if line.strip() == "":
continue continue
log_object = json.loads(line) log_object = json.loads(line)
logs_cb(log_object) logs_cb(log_object)
except Exception as e: except Exception as e:
proc.kill() try:
try: logs_cb({"sist2-admin": f"Could not decode log line: {line}; {e}"})
print(line) except NameError:
except NameError: pass
pass
print(traceback.format_exc())
finally:
pass
# proc.wait()
# pipe_wrapper.close()
def web(self, options: WebOptions, name: str): def web(self, options: WebOptions, name: str):