mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Ensure status bar displays full progress.
This commit is contained in:
parent
800c2f8dcd
commit
1b3711352e
@ -323,9 +323,10 @@ func main() {
|
|||||||
if isTerminal {
|
if isTerminal {
|
||||||
logPrefix = "\r" // clear status bar when printing
|
logPrefix = "\r" // clear status bar when printing
|
||||||
// Display a status bar so devs can estimate completion times.
|
// Display a status bar so devs can estimate completion times.
|
||||||
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
total := len(ps) * len(c.dirs)
|
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)
|
work := atomic.LoadInt64(¤tWork)
|
||||||
dir := c.dirs[work>>8]
|
dir := c.dirs[work>>8]
|
||||||
platform := ps[work&0xFF]
|
platform := ps[work&0xFF]
|
||||||
@ -333,12 +334,16 @@ func main() {
|
|||||||
dir = dir[:80]
|
dir = dir[:80]
|
||||||
}
|
}
|
||||||
fmt.Printf("\r%d/%d \033[2m%-13s\033[0m %-80s", proc, total, platform, dir)
|
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)
|
time.Sleep(50 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
fmt.Println()
|
|
||||||
for _, status := range statuses {
|
for _, status := range statuses {
|
||||||
if status != 0 {
|
if status != 0 {
|
||||||
os.Exit(status)
|
os.Exit(status)
|
||||||
|
Loading…
Reference in New Issue
Block a user