<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    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.<br>
    <br>
    On 08/09/2012 10:24 AM, Ashwin Mangale wrote:
    <blockquote
cite="mid:CAKrAB_qphJGCGZg1u87xALLmXaxJnt=4d=pd_FXiCEZTKBycWg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html;
        charset=ISO-8859-1">
      Hi,<br>
      <br>
      Instead of:<br>
      io:format(user, "foo\nbar\nbaz", []).<br>
      <br>
      Try:<br>
      io:format(user, "foo\r\nbar\r\nbaz", []). <br>
      <br>
      <br>
      This should give the proper formatted output.<br>
      <br>
      Regards,<br>
      Ashwin<br>
      <br>
      <div>On Thu, Aug 9, 2012 at 10:47 PM, José Valim <span><<a
            moz-do-not-send="true" href="mailto:jose.valim@gmail.com">jose.valim@gmail.com</a>></span>
        wrote:<br>
        <blockquote>More info:
          <div><br>
          </div>
          <div>Running on Mac OS Snow Leopard, Erlang R15B or R15B01.</div>
          <div><br>
          </div>
          <div>user_drv:start() is spawning user:start() and not 'tty -c
            -e'.
            <div>
              <br>
              <div><br>
              </div>
              <div><br>
              </div>
              <span><b><span>
                    <div><span><b>José Valim</b></span></div>
                    <div><span>
                        <div><span><a moz-do-not-send="true"
                              href="http://www.plataformatec.com.br/">www.plataformatec.com.br</a></span></div>
                        <div><span>Founder and Lead Developer</span></div>
                      </span></div>
                  </span></b></span><br>
              <br>
              <br>
            </div>
            <div>
              <div>
                <div>On Thu, Aug 9, 2012 at 2:07 PM, José Valim <span><<a
                      moz-do-not-send="true"
                      href="mailto:jose.valim@gmail.com">jose.valim@gmail.com</a>></span>
                  wrote:<br>
                  <blockquote>
                    Hello everyone,
                    <div><br>
                    </div>
                    <div>If I run the following command:</div>
                    <div><br>
                    </div>
                    <blockquote>
                      <div> $ erl -noinput -s user_drv </div>
                    </blockquote>
                    <div><br>
                    </div>
                    And then try to send any io message to the user
                    process, the message appears skewed:
                    <div><br>
                    </div>
                    <blockquote>
                      <div> 1> io:format(user, "foo\nbar\nbaz", []).
                      </div>
                    </blockquote>
                    <blockquote>
                      <div>
                        <div>
                          <div> foo </div>
                        </div>
                      </div>
                      <div>
                        <div>
                          <div>    bar </div>
                        </div>
                      </div>
                      <div>
                        <div>
                          <div>       bazok </div>
                        </div>
                      </div>
                    </blockquote>
                    <div>
                      <div><br>
                        <div>However, sending the message to io makes it
                          appear correctly:</div>
                        <div><br>
                        </div>
                      </div>
                    </div>
                    <blockquote>
                      <div>
                        <div>
                          <div>
                            <div> 2> io:format(standard_io,
                              "foo\nbar\nbaz", []).          </div>
                          </div>
                        </div>
                      </div>
                      <div>
                        <div>
                          <div> foo </div>
                        </div>
                      </div>
                      <div>
                        <div>
                          <div> bar </div>
                        </div>
                      </div>
                      <div>
                        <div>
                          <div> bazok </div>
                        </div>
                      </div>
                    </blockquote>
                    <div>
                      <div><br>
                      </div>
                      <div>This becomes a major problem when printing
                        error logger messages to tty, which become
                        completely unreadable.</div>
                      <div><br>
                      </div>
                      <div>I have found out this issue when starting an
                        Elixir shell with user_drv.</div>
                      <div>The issue also appears with LFE and any other
                        time user_drv is started manually.</div>
                      <div><br>
                      </div>
                      <div>Does anyone know a fix to this problem or how
                        I could debug it further?</div>
                      <span>
                        <div>
                          <br>
                        </div>
                        <span><b><span>
                              <div>
                                <span><b>José Valim</b></span></div>
                              <div><span>
                                  <div><span><a moz-do-not-send="true"
                                        href="http://www.plataformatec.com.br/">www.plataformatec.com.br</a></span></div>
                                  <div><span>Founder and Lead Developer</span></div>
                                </span></div>
                            </span></b></span><br>
                      </span></div>
                  </blockquote>
                </div>
                <br>
              </div>
            </div>
          </div>
          <br>
          _______________________________________________<br>
          erlang-questions mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
          <a moz-do-not-send="true"
            href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
          <br>
        </blockquote>
      </div>
      <br>
      <br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>