mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Added better handling for non UTF-8 characters in output
This commit is contained in:
parent
a86181e368
commit
cf1403a0ee
@ -68,11 +68,11 @@ class ServerOutBuf:
|
|||||||
def check(self):
|
def check(self):
|
||||||
while True:
|
while True:
|
||||||
if self.proc.poll() is None:
|
if self.proc.poll() is None:
|
||||||
char = self.proc.stdout.read(1).decode('utf-8')
|
char = self.proc.stdout.read(1).decode('utf-8', 'ignore')
|
||||||
# TODO: we may want to benchmark reading in blocks and userspace processing it later, reads are kind of expensive as a syscall
|
# TODO: we may want to benchmark reading in blocks and userspace processing it later, reads are kind of expensive as a syscall
|
||||||
self.process_byte(char)
|
self.process_byte(char)
|
||||||
else:
|
else:
|
||||||
flush = self.proc.stdout.read().decode('utf-8')
|
flush = self.proc.stdout.read().decode('utf-8', 'ignore')
|
||||||
for char in flush:
|
for char in flush:
|
||||||
self.process_byte(char)
|
self.process_byte(char)
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user