[erlang-bugs] io:get_chars no longer respecting Control-D (eof) in Erlang 18.1

Tony Wallace tony@REDACTED
Thu Feb 18 10:43:36 CET 2016


The task is to produce an escript that reads standard input.  The code
that used to work was:


read_stdin() ->
    lists:flatten(read_stdin(io:get_chars(standard_io,"",8192))).
read_stdin(eof) ->
    [];
read_stdin(Data) ->
    [Data|read_stdin(io:get_chars(standard_io,"",8192))].


Now this code causes the program to hang.  If I try the following
command from the erlang prompt:

2> io:get_chars("",10).


and then try to end the input with control-D the command does not
return.  It could be a problem with
the shell intercepting the control-D or io:get_chars could be broken.

Tony Wallace





More information about the erlang-bugs mailing list