summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraudiofanatic <audiofanatic@gmail.com>2009-06-15 18:23:49 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-06-15 18:31:13 (GMT)
commit3fd25c90fab85fc6aa9949311b13992c63ba7345 (patch)
treecf53eed49686919544ff709e16539da3dcdebe44
parent4aee3ada19e83f9802832b6e31dcffccb1693522 (diff)
downloadQt-3fd25c90fab85fc6aa9949311b13992c63ba7345.zip
Qt-3fd25c90fab85fc6aa9949311b13992c63ba7345.tar.gz
Qt-3fd25c90fab85fc6aa9949311b13992c63ba7345.tar.bz2
Force line buffering for stdout so it stays in sync better with stderr (which is unbuffered)
Task-number: 254786 Merge-request: 610 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
-rw-r--r--qmake/main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/qmake/main.cpp b/qmake/main.cpp
index fe274c4..7da66ac 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -84,6 +84,13 @@ bool qmake_setpwd(const QString &p)
int runQMake(int argc, char **argv)
{
+ // stderr is unbuffered by default, but stdout buffering depends on whether
+ // there is a terminal attached. Buffering can make output from stderr and stdout
+ // appear out of sync, so force stdout to be line buffered to minimize this without
+ // hurting performance too much (if at all). This is particularly important for
+ // things like QtCreator and scripted builds.
+ setvbuf(stdout, (char *)NULL, _IOLBF, 0);
+
// parse command line
int ret = Option::init(argc, argv);
if(ret != Option::QMAKE_CMDLINE_SUCCESS) {