diff options
author | Dan Willemsen <dwillemsen@google.com> | 2018-07-12 21:26:10 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2018-07-12 21:59:49 -0700 |
commit | f78a73444e7b6c97d53ad90884c83dce0ca55a79 (patch) | |
tree | 5441f27a454e3be32f20cfb63783f73850ed1fa2 | |
parent | 9611199b944e18b6330b8d32e63ac6ac71588d58 (diff) | |
download | build_soong-f78a73444e7b6c97d53ad90884c83dce0ca55a79.tar.gz build_soong-f78a73444e7b6c97d53ad90884c83dce0ca55a79.tar.bz2 build_soong-f78a73444e7b6c97d53ad90884c83dce0ca55a79.zip |
Move all status output to stdout
I've noticed a few instances of interleaved status messages in between
lines in a terminal/Writer.Print call on our build servers. Since
there's a lock protecting everything we write, I've got to assume this
is a stdout vs stderr problem. Ninja had always been outputing to
stdout, except for error messages, which are now marked with FAILED:
like failed actions.
Test: m blueprint_tools
Test: m missing
Change-Id: Idf8320d40694abf212c902c63a9703e4440ffb7a
-rw-r--r-- | ui/terminal/status.go | 4 | ||||
-rw-r--r-- | ui/terminal/writer.go | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/ui/terminal/status.go b/ui/terminal/status.go index 5719456f..c8eb382f 100644 --- a/ui/terminal/status.go +++ b/ui/terminal/status.go @@ -45,7 +45,9 @@ func NewStatusOutput(w Writer, statusFormat string) status.StatusOutput { } func (s *statusOutput) Message(level status.MsgLevel, message string) { - if level > status.StatusLvl { + if level >= status.ErrorLvl { + s.writer.Print(fmt.Sprintf("FAILED: %s", message)) + } else if level > status.StatusLvl { s.writer.Print(fmt.Sprintf("%s%s", level.Prefix(), message)) } else if level == status.StatusLvl { s.writer.StatusLine(message) diff --git a/ui/terminal/writer.go b/ui/terminal/writer.go index dd322268..351c00c1 100644 --- a/ui/terminal/writer.go +++ b/ui/terminal/writer.go @@ -81,8 +81,8 @@ func NewWriter(stdio StdioInterface) Writer { } if term, ok := os.LookupEnv("TERM"); ok && term != "dumb" { - w.stripEscapes = !isTerminal(stdio.Stderr()) - w.smartTerminal = isTerminal(stdio.Stdout()) && !w.stripEscapes + w.smartTerminal = isTerminal(stdio.Stdout()) + w.stripEscapes = !w.smartTerminal } return w @@ -127,9 +127,9 @@ func (w *writerImpl) print(str string) { fmt.Fprint(w.stdio.Stdout(), "\r", "\x1b[K") w.haveBlankLine = true } - fmt.Fprint(w.stdio.Stderr(), str) + fmt.Fprint(w.stdio.Stdout(), str) if len(str) == 0 || str[len(str)-1] != '\n' { - fmt.Fprint(w.stdio.Stderr(), "\n") + fmt.Fprint(w.stdio.Stdout(), "\n") } } |