From 75b0f73f72e1783d4ace976cdd2b5f23bdc3ebae Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 28 Feb 2018 10:04:53 +0100 Subject: kernel: Fix handling of os:cmd option max_size in win --- lib/kernel/src/os.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/kernel/src/os.erl') 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 -- cgit v1.2.3