[erlang-questions] buffered io:format in the shell
Serge Aleynikov
saleyn@REDACTED
Mon May 21 02:32:19 CEST 2007
Hi,
I have a driver that delivers messages to a gen_server process using
driver_output function. On the Erlang side the messages are received in
the form:
handle_info({Port, {data, Data}}, #state{port=Port} = State) ->
case binary_to_term(Data) of
{msg, Subj, [], Msg} ->
io:format("To: ~s, Msg: ~s~n", [Subj, Msg]);
Other ->
error_log:error_msg("Unknown msg from port: ~p~n", [Other])
end,
{noreply, State};
The communication between the driver and Erlang process seems to work
fine with the exception that the result of io:format/2 call doesn't get
printed to the shell immediately after the message from driver is
received. It gets printed only after I hit the <Enter> key on the
keyboard. Any idea why?
Serge
More information about the erlang-questions
mailing list