aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-01-23 11:08:51 -0500
committerRuss Cox <rsc@golang.org>2015-01-23 17:13:33 +0000
commit07a27ce09ea01c1939389d5f5e1d3414fc893882 (patch)
treeab8d21df355d72f7d31e656ccba880b706dfbf4f /src/cmd
parentfdeee3a538e4816540e46195e7c14af2ad4ad190 (diff)
downloadgo-07a27ce09ea01c1939389d5f5e1d3414fc893882.tar.xz
[dev.cc] cmd/dist: show bootstrap build progress in real time
Change-Id: I97bbf7a276c8f99554f0e3a9bcc8d3792a5e0f65 Reviewed-on: https://go-review.googlesource.com/3221 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/dist/util.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go
index 1bb3ba80e6..decbb0ffd2 100644
--- a/src/cmd/dist/util.go
+++ b/src/cmd/dist/util.go
@@ -84,8 +84,23 @@ func run(dir string, mode int, cmd ...string) string {
xcmd := exec.Command(cmd[0], cmd[1:]...)
xcmd.Dir = dir
+ var data []byte
var err error
- data, err := xcmd.CombinedOutput()
+
+ // If we want to show command output and this is not
+ // a background command, assume it's the only thing
+ // running, so we can just let it write directly stdout/stderr
+ // as it runs without fear of mixing the output with some
+ // other command's output. Not buffering lets the output
+ // appear as it is printed instead of once the command exits.
+ // This is most important for the invocation of 'go1.4 build -v bootstrap/...'.
+ if mode&(Background|ShowOutput) == ShowOutput {
+ xcmd.Stdout = os.Stdout
+ xcmd.Stderr = os.Stderr
+ err = xcmd.Run()
+ } else {
+ data, err = xcmd.CombinedOutput()
+ }
if err != nil && mode&CheckExit != 0 {
outputLock.Lock()
if len(data) > 0 {