Issues

Issue #711 wontfix

should stdout be unbuffered by default?

John Kaniarz
created an issue

I was debugging some code in love and I added print statements to help debug. Unfortunately, the stock lua print routine doesn't ever flush the buffer, (with or without a newline), and my debug info wouldn't show up until I exited the program.

I did some research into this and this is 'correct' behavior according to the C standard which specifies that stdout should be buffered unless the output is to an 'interactive device'. This is compounded with the fact that the C print functions that lua's 'print' emulates aren't required to flush the buffer at any time.

Considering its interactive nature, should stdout be unbuffered by default in love? I've worked around this by putting "io.stdout:setvbuf 'no'" in my conf.lua.

Here's an exchange from the lua mailing list for reference: http://lua.2524044.n2.nabble.com/print-stdout-and-flush-td6406981.html

And some more info on stdout buffering: http://stackoverflow.com/questions/3723795/is-stdout-line-buffered-unbuffered-or-indeterminate-by-default

Comments (3)

  1. Bart van Strien

    I see very little reason to change this behaviour, keep in mind that this is mostly used for (frankly, broken) ide's, and they can control the buffering too.

    (But do re-open if you think you have a good case.)

  2. Log in to comment