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

Tony Wallace <[email protected]> Fri, 19 Feb 2016 16:26:17 +1300
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============5133418713857679777==
Content-Type: multipart/alternative;
 boundary="------------020901030701010108010601"

This is a multi-part message in MIME format.
--------------020901030701010108010601
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

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 <[email protected]>
To: 	[email protected]



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





--------------020901030701010108010601
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>

    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
  </head>
  <body text=3D"#000000" bgcolor=3D"#FFFFFF">
    My apologies.=C2=A0 Not sure why I had problems (yet) but it is not<b=
r>
    an erlang bug.<br>
    <br>
    <br>
    Tony<br>
    <div class=3D"moz-forward-container"><br>
      <br>
      -------- Forwarded Message --------
      <table class=3D"moz-email-headers-table" cellpadding=3D"0"
        cellspacing=3D"0" border=3D"0">
        <tbody>
          <tr>
            <th nowrap=3D"nowrap" valign=3D"BASELINE" align=3D"RIGHT">Sub=
ject:
            </th>
            <td>io:get_chars no longer respecting Control-D (eof) in
              Erlang 18.1</td>
          </tr>
          <tr>
            <th nowrap=3D"nowrap" valign=3D"BASELINE" align=3D"RIGHT">Dat=
e: </th>
            <td>Thu, 18 Feb 2016 22:43:36 +1300</td>
          </tr>
          <tr>
            <th nowrap=3D"nowrap" valign=3D"BASELINE" align=3D"RIGHT">Fro=
m: </th>
            <td>Tony Wallace <a class=3D"moz-txt-link-rfc2396E" href=3D"m=
ailto:[email protected]">&lt;[email protected]&gt;</a></td>
          </tr>
          <tr>
            <th nowrap=3D"nowrap" valign=3D"BASELINE" align=3D"RIGHT">To:=
 </th>
            <td><a class=3D"moz-txt-link-abbreviated" href=3D"mailto:erla=
[email protected]">[email protected]</a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <pre>The task is to produce an escript that reads standard input.  =
The code
that used to work was:


read_stdin() -&gt;
    lists:flatten(read_stdin(io:get_chars(standard_io,"",8192))).
read_stdin(eof) -&gt;
    [];
read_stdin(Data) -&gt;
    [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&gt; 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


</pre>
      <br>
    </div>
    <br>
  </body>
</html>

--------------020901030701010108010601--

--===============5133418713857679777==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============5133418713857679777==--