[erlang-questions] user_drv cannot properly print new lines

José Valim <>
Thu Aug 9 19:27:11 CEST 2012


Yes, it does, thanks!

However, error_logger, lager and everything else just sends \n.
So while I could control my output, I cannot control such tools.
Maybe something in user_drv or user should convert \n to \r\n?


*
José Valim
www.plataformatec.com.br
Founder and Lead Developer
*


On Thu, Aug 9, 2012 at 2:24 PM, Ashwin Mangale <>wrote:

> 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 <> 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 <> 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
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120809/87207217/attachment.html>


More information about the erlang-questions mailing list