io:get_chars no longer respecting Control-D (eof) in Erlang 18.1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

io:get_chars no longer respecting Control-D (eof) in Erlang 18.1

Tony Wallace
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


_______________________________________________
erlang-bugs mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-bugs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: io:get_chars no longer respecting Control-D (eof) in Erlang 18.1

Tony Wallace
My apologies.  Not sure why I had problems (yet) but it is not
an erlang bug.


Tony


-------- Forwarded Message --------
Subject: io:get_chars no longer respecting Control-D (eof) in Erlang 18.1
Date: Thu, 18 Feb 2016 22:43:36 +1300
From: Tony Wallace [hidden email]
To: [hidden email]


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





_______________________________________________
erlang-bugs mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-bugs
Loading...