[erlang-questions] user_drv cannot properly print new lines

Ashwin Mangale ashwin.mangale@REDACTED
Thu Aug 9 19:24:09 CEST 2012


Hi,

Instead of:
io:format(user, "foo\nbar\nbaz", []).

Try:
io:format(user, "foo\r\nbar\r\nbaz", []).


This should give the proper formatted output.

Regards,
Ashwin

On Thu, Aug 9, 2012 at 10:47 PM, José Valim <jose.valim@REDACTED> wrote:

> More info:
>
> Running on Mac OS Snow Leopard, Erlang R15B or R15B01.
>
> user_drv:start() is spawning user:start() and not 'tty -c -e'.
>
>
>
> *
> José Valim
> www.plataformatec.com.br
> Founder and Lead Developer
> *
>
>
> On Thu, Aug 9, 2012 at 2:07 PM, José Valim <jose.valim@REDACTED> wrote:
>
>> Hello everyone,
>>
>> If I run the following command:
>>
>> $ erl -noinput -s user_drv
>>
>>
>> And then try to send any io message to the user process, the message
>> appears skewed:
>>
>> 1> io:format(user, "foo\nbar\nbaz", []).
>>
>> foo
>>    bar
>>       bazok
>>
>>
>> However, sending the message to io makes it appear correctly:
>>
>> 2> io:format(standard_io, "foo\nbar\nbaz", []).
>> foo
>> bar
>> bazok
>>
>>
>> This becomes a major problem when printing error logger messages to tty,
>> which become completely unreadable.
>>
>> I have found out this issue when starting an Elixir shell with user_drv.
>> The issue also appears with LFE and any other time user_drv is started
>> manually.
>>
>> Does anyone know a fix to this problem or how I could debug it further?
>>
>> *
>> José Valim
>> www.plataformatec.com.br
>> Founder and Lead Developer
>> *
>>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120809/210904c7/attachment.htm>


More information about the erlang-questions mailing list