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>