File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -483,22 +483,14 @@ defmodule IO do
483
483
defp getn_eof ( device , prompt , acc ) do
484
484
case :io . get_line ( device , prompt ) do
485
485
line when is_binary ( line ) or is_list ( line ) -> getn_eof ( device , '' , [ line | acc ] )
486
- :eof -> read_eof ( device , :lists . reverse ( acc ) )
486
+ :eof -> wrap_eof ( :lists . reverse ( acc ) )
487
487
other -> other
488
488
end
489
489
end
490
490
491
- defp read_eof ( _device , [ h | _ ] = acc ) when is_binary ( h ) , do: IO . iodata_to_binary ( acc )
492
- defp read_eof ( _device , [ h | _ ] = acc ) when is_list ( h ) , do: :lists . flatten ( acc )
493
-
494
- defp read_eof ( device , [ ] ) do
495
- with [ _ | _ ] = opts <- :io . getopts ( device ) ,
496
- false <- Keyword . get ( opts , :binary , true ) do
497
- ''
498
- else
499
- _ -> ""
500
- end
501
- end
491
+ defp wrap_eof ( [ h | _ ] = acc ) when is_binary ( h ) , do: IO . iodata_to_binary ( acc )
492
+ defp wrap_eof ( [ h | _ ] = acc ) when is_list ( h ) , do: :lists . flatten ( acc )
493
+ defp wrap_eof ( [ ] ) , do: :eof
502
494
503
495
@ doc ~S"""
504
496
Reads a line from the IO `device`.
You can’t perform that action at this time.
0 commit comments