diff options
Diffstat (limited to 'lib/kernel/src/os.erl')
-rw-r--r-- | lib/kernel/src/os.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl index ae188ae932..a4b4f798f9 100644 --- a/lib/kernel/src/os.erl +++ b/lib/kernel/src/os.erl @@ -319,16 +319,16 @@ get_data(Port, MonRef, Eot, Sofar, Size, Max) -> iolist_to_binary(Sofar) end. -eot(_Bs, <<>>, _Size, _Max) -> +eot(Bs, <<>>, Size, Max) when Size + byte_size(Bs) < Max -> more; +eot(Bs, <<>>, Size, Max) -> + binary:part(Bs, {0, Max - Size}); eot(Bs, Eot, Size, Max) -> case binary:match(Bs, Eot) of - nomatch when Size + byte_size(Bs) < Max -> - more; {Pos, _} when Size + Pos < Max -> binary:part(Bs,{0, Pos}); _ -> - binary:part(Bs,{0, Max - Size}) + eot(Bs, <<>>, Size, Max) end. %% When port_close returns we know that all the |