fix
This commit is contained in:
@ -53,10 +53,16 @@ class DataReader:
|
||||
os.set_blocking(self._fd, False)
|
||||
|
||||
def read_available(self):
|
||||
try:
|
||||
return os.read(self._fd, READ_CHUNK)
|
||||
except BlockingIOError:
|
||||
return b""
|
||||
chunks = []
|
||||
while True:
|
||||
try:
|
||||
data = os.read(self._fd, READ_CHUNK)
|
||||
if not data:
|
||||
break
|
||||
chunks.append(data)
|
||||
except BlockingIOError:
|
||||
break
|
||||
return b"".join(chunks)
|
||||
|
||||
def close(self):
|
||||
os.close(self._fd)
|
||||
|
||||
Reference in New Issue
Block a user