[erlang-questions] user_drv cannot properly print new lines

Michael Truog <>
Thu Aug 9 21:58:31 CEST 2012


This problem also pops up if a linked-in driver has any usage of stdout.  For some reason there is usage of '\r\n' as newlines within the erlang VM somewhere, which seems very awkward when running on unix/linux.

On 08/09/2012 10:24 AM, 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 < <mailto:>> 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 <http://www.plataformatec.com.br/>
>     Founder and Lead Developer
>     *
>
>
>     On Thu, Aug 9, 2012 at 2:07 PM, José Valim < <mailto:>> 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 <http://www.plataformatec.com.br/>
>         Founder and Lead Developer
>         *
>
>
>
>     _______________________________________________
>     erlang-questions mailing list
>      <mailto:>
>     http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
>
> _______________________________________________
> 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/38461943/attachment.html>


More information about the erlang-questions mailing list