aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-02-28 10:04:53 +0100
committerLukas Larsson <[email protected]>2018-03-01 10:25:24 +0100
commit75b0f73f72e1783d4ace976cdd2b5f23bdc3ebae (patch)
tree879dc876b4bc99b4853145d17ba3f194594f5424 /lib/kernel/src
parentb600910bf17c92721fb8da04e8c508d6395dabc4 (diff)
downloadotp-75b0f73f72e1783d4ace976cdd2b5f23bdc3ebae.tar.gz
otp-75b0f73f72e1783d4ace976cdd2b5f23bdc3ebae.tar.bz2
otp-75b0f73f72e1783d4ace976cdd2b5f23bdc3ebae.zip
kernel: Fix handling of os:cmd option max_size in win
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/os.erl8
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