SMALL UPDATE:<br><br><br>If I "put the shell process to sleep":<br><br>> timer:sleep(5000).<br><br>The prompt from the io:read appears. <br>It seems that the shell process "greedily" locks the io monitor...<br>
<br><br><br><br><br><div class="gmail_quote">2012/11/30 Álvaro <span dir="ltr"><<a href="mailto:avalormaquedano@gmail.com" target="_blank">avalormaquedano@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear all,<br><br>Every time I run this simple code, my program gets stuck:<br><br>> Pid = spawn (moduleName,myread,["hello"]).<br><br>where:<br><br>myread(Prompt)-><br>    try<br>      Result = io:read(Prompt),<br>

      io:format("Res: ~p~n",[Result]),<br>    catch<br>    A:B-><br>        io:format("Read error: ~p:~p~n",[A,B]),<br>        false<br>    end.<br><br><br>if I check the status of the process:<br>
<br>
> erlang:process_info(Pid).<br><br>[{current_function,{io,wait_io_mon_reply,2}},<br> {initial_call,{default_environment,myread,1}},<br> {status,waiting},<br> {message_queue_len,0},<br> {messages,[]},<br> {links,[]},<br>

 {dictionary,[]},<br> {trap_exit,false},<br> {error_handler,error_handler},<br> {priority,normal},<br> {group_leader,<0.25.0>},<br> {total_heap_size,233},<br> {heap_size,233},<br> {stack_size,7},<br> {reductions,28},<br>

 {garbage_collection,[{min_bin_vheap_size,46368},<br>                      {min_heap_size,233},<br>                      {fullsweep_after,65535},<br>                      {minor_gcs,0}]},<br> {suspending,[]}]<br><br><br>
It seems to be stuck in the function io:wait_io_mon_reply/2 (surfing through io.erl I found that this function waits for a response from the  process managing the io ). This process is not answering, hence my code stops working.<br>

I've checked that the "group_leader()" once I spawn the reading process is the same used by my shell.<br><br>Any ideas on how to deal with it?<br><br>Regards,<br>Álvaro<br>
</blockquote></div><br>