mirror of https://github.com/docker/compose.git
Fix line buffering when there's UTF-8 in a container's output
This commit is contained in:
parent
7a4b69edc0
commit
059d240824
|
@ -55,10 +55,15 @@ def read_websocket(websocket):
|
|||
break
|
||||
|
||||
def split_buffer(reader, separator):
|
||||
"""
|
||||
Given a generator which yields strings and a separator string,
|
||||
joins all input, splits on the separator and yields each chunk.
|
||||
Requires that each input string is decodable as UTF-8.
|
||||
"""
|
||||
buffered = ''
|
||||
|
||||
for data in reader:
|
||||
lines = (buffered + data).split(separator)
|
||||
lines = (buffered + data.decode('utf-8')).split(separator)
|
||||
for line in lines[:-1]:
|
||||
yield line + separator
|
||||
if len(lines) > 1:
|
||||
|
|
Loading…
Reference in New Issue