From: Shenghou Ma Date: Tue, 28 Feb 2012 18:22:28 +0000 (+0800) Subject: cmd/dist: force line-buffering stdout/stderr on Unix X-Git-Tag: weekly.2012-03-04~108 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=26daf6a03f7c44b04b3654f6bda1f4a11fbf9df1;p=gostls13.git 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 --- 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 = "/";