Skip to content

Commit 18a5d8a

Browse files
sokolnickimJosé Valim
authored andcommitted
Read 4K blocks instead of lines in IO.binread
Fix for incorrect handling of 0x0D0A (CR+LF) sequence when reading binary files with option :all Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
1 parent cd80994 commit 18a5d8a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/elixir/lib/io.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ defmodule IO do
123123
end
124124
end
125125

126+
@read_all_size 4096
126127
defp do_binread_all(mapped_dev, acc) do
127-
case :file.read_line(mapped_dev) do
128+
case :file.read(mapped_dev, @read_all_size) do
128129
{:ok, data} -> do_binread_all(mapped_dev, acc <> data)
129130
:eof -> acc
130131
other -> other

0 commit comments

Comments
 (0)