@@ -100,16 +100,16 @@ def _parse_lines_from_buffer(buf):
100
100
# end
101
101
102
102
def _read_lines_from_fno (fno , last_buf_list ):
103
- buf = os .read (fno , mmap .PAGESIZE )
104
- buf = last_buf_list [0 ] + buf
103
+ for buf in iter ( lambda : os .read (fno , mmap .PAGESIZE ), b'' ):
104
+ buf = last_buf_list [0 ] + buf
105
105
106
- bi = 0
107
- for bi , line in _parse_lines_from_buffer (buf ):
108
- yield line
109
- # for each line to parse from the buffer
106
+ bi = 0
107
+ for bi , line in _parse_lines_from_buffer (buf ):
108
+ yield line
109
+ # for each line to parse from the buffer
110
110
111
- # keep remainder
112
- last_buf_list [0 ] = buf [bi :]
111
+ # keep remainder
112
+ last_buf_list [0 ] = buf [bi :]
113
113
114
114
def _dispatch_single_line (line , handler ):
115
115
line = line .decode (defenc )
@@ -199,6 +199,7 @@ def _deplete_buffer(fno, handler, buf_list, wg=None):
199
199
for fno , (handler , buf_list ) in fdmap .items ():
200
200
wg .add (1 )
201
201
t = threading .Thread (target = lambda : _deplete_buffer (fno , handler , buf_list , wg ))
202
+ t .setDaemon (True )
202
203
t .start ()
203
204
# end
204
205
# NOTE: Just joining threads can possibly fail as there is a gap between .start() and when it's
0 commit comments