From 1b3711352e78e4ea01aac9268fdce1e550f82162 Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Tue, 27 Feb 2018 14:32:06 -0800 Subject: [PATCH] Ensure status bar displays full progress. --- test/typecheck/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/typecheck/main.go b/test/typecheck/main.go index e9e885cb310..411a945d477 100644 --- a/test/typecheck/main.go +++ b/test/typecheck/main.go @@ -323,9 +323,10 @@ func main() { if isTerminal { logPrefix = "\r" // clear status bar when printing // Display a status bar so devs can estimate completion times. + wg.Add(1) go func() { total := len(ps) * len(c.dirs) - for proc := 0; proc < total; proc = int(atomic.LoadInt64(&processedDirs)) { + for proc := 0; ; proc = int(atomic.LoadInt64(&processedDirs)) { work := atomic.LoadInt64(¤tWork) dir := c.dirs[work>>8] platform := ps[work&0xFF] @@ -333,12 +334,16 @@ func main() { dir = dir[:80] } fmt.Printf("\r%d/%d \033[2m%-13s\033[0m %-80s", proc, total, platform, dir) + if proc == total { + fmt.Println() + break + } time.Sleep(50 * time.Millisecond) } + wg.Done() }() } wg.Wait() - fmt.Println() for _, status := range statuses { if status != 0 { os.Exit(status)