Make stdout/stderr line buffered

This improves the behaviour with print()ing for debugging, when the
output is redirected to a file.

I was using `setbuf(…, 0)` initially, but it makes sense to buffer it
per line.  This uses `setvbuf` instead of `setlinebuf`, which might not
be available everywhere.

Closes https://github.com/awesomeWM/awesome/pull/267
This commit is contained in:
Daniel Hahler 2015-06-20 02:08:04 +02:00 committed by Uli Schlachter
parent 4c517cf9d3
commit 925e6ecc17
1 changed files with 4 additions and 0 deletions

View File

@ -331,6 +331,10 @@ main(int argc, char **argv)
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
/* Make stdout/stderr line buffered. */
setvbuf(stdout, NULL, _IOLBF, 0);
setvbuf(stderr, NULL, _IOLBF, 0);
/* clear the globalconf structure */ /* clear the globalconf structure */
p_clear(&globalconf, 1); p_clear(&globalconf, 1);
globalconf.keygrabber = LUA_REFNIL; globalconf.keygrabber = LUA_REFNIL;