mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Core: patch stream_input to ignore non-parsable input (such as EOF encoded as 0xff) (#854)
This commit is contained in:
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)
|
||||||
|
Reference in New Issue
Block a user