After a build action fails, stop printing more output.
Often the slow commands (errorprone happens to be particularly bad)
print a lot, so this should make it easier to find the error without
lots of scrolling.
This doesn't attempt to parse the output and re-display errors, so
if a command prints a thousand warnings with one error in the middle,
it'll still be hard to find the error.
Bug: 277114612
Test: cd build/soong/ui/terminal ; go test
Change-Id: I6c8285fc2c6e4fc345de57b2c15bc5e7d46b1d1f
diff --git a/ui/terminal/smart_status.go b/ui/terminal/smart_status.go
index 06a4064..3880b04 100644
--- a/ui/terminal/smart_status.go
+++ b/ui/terminal/smart_status.go
@@ -53,6 +53,13 @@
done chan bool
sigwinch chan os.Signal
sigwinchHandled chan bool
+
+ // Once there is a failure, we stop printing command output so the error
+ // is easier to find
+ haveFailures bool
+ // If we are dropping errors, then at the end, we report a message to go
+ // look in the verbose log if you want that command output.
+ postFailureActionCount int
}
// NewSmartStatusOutput returns a StatusOutput that represents the
@@ -165,12 +172,20 @@
}
}
+ s.statusLine(progress)
+
+ // Stop printing when there are failures, but don't skip actions that also have their own errors.
if output != "" {
- s.statusLine(progress)
- s.requestLine()
- s.print(output)
- } else {
- s.statusLine(progress)
+ if !s.haveFailures || result.Error != nil {
+ s.requestLine()
+ s.print(output)
+ } else {
+ s.postFailureActionCount++
+ }
+ }
+
+ if result.Error != nil {
+ s.haveFailures = true
}
}
@@ -187,6 +202,15 @@
s.stopSigwinch()
+ if s.postFailureActionCount > 0 {
+ s.requestLine()
+ if s.postFailureActionCount == 1 {
+ s.print(fmt.Sprintf("There was 1 action that completed after the action that failed. See verbose.log.gz for its output."))
+ } else {
+ s.print(fmt.Sprintf("There were %d actions that completed after the action that failed. See verbose.log.gz for their output.", s.postFailureActionCount))
+ }
+ }
+
s.requestLine()
s.runningActions = nil