Core: patch stream_input to ignore non-parsable input (such as EOF encoded as 0xff) (#854)
This commit is contained in:
parent
b47cca4515
commit
59918b9dbc
10
Utils.py
10
Utils.py
|
@ -479,9 +479,13 @@ def init_logging(name: str, loglevel: typing.Union[str, int] = logging.INFO, wri
|
||||||
def stream_input(stream, queue):
|
def stream_input(stream, queue):
|
||||||
def queuer():
|
def queuer():
|
||||||
while 1:
|
while 1:
|
||||||
text = stream.readline().strip()
|
try:
|
||||||
if text:
|
text = stream.readline().strip()
|
||||||
queue.put_nowait(text)
|
except UnicodeDecodeError as e:
|
||||||
|
logging.exception(e)
|
||||||
|
else:
|
||||||
|
if text:
|
||||||
|
queue.put_nowait(text)
|
||||||
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
thread = Thread(target=queuer, name=f"Stream handler for {stream.name}", daemon=True)
|
thread = Thread(target=queuer, name=f"Stream handler for {stream.name}", daemon=True)
|
||||||
|
|
Loading…
Reference in New Issue