From 26daf6a03f7c44b04b3654f6bda1f4a11fbf9df1 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Wed, 29 Feb 2012 02:22:28 +0800 Subject: [PATCH] cmd/dist: force line-buffering stdout/stderr on Unix If stdout and stderr are indeed the same file (not a tty), which is often the case, fully-buffered stdout will make it harder to see progresses, for example, ./make.bash 2>&1 | tee log R=r, rsc CC=golang-dev https://golang.org/cl/5700070 --- src/cmd/dist/unix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmd/dist/unix.c b/src/cmd/dist/unix.c index 76622a4d88..e6d82e14ef 100644 --- a/src/cmd/dist/unix.c +++ b/src/cmd/dist/unix.c @@ -641,6 +641,9 @@ main(int argc, char **argv) Buf b; struct utsname u; + setvbuf(stdout, nil, _IOLBF, 0); + setvbuf(stderr, nil, _IOLBF, 0); + binit(&b); slash = "/";