From 8ae1f7aab03b717d92f2c064f6ab5ea5487c524a Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 12 Feb 2014 11:56:42 +0400 Subject: [PATCH] Fix: progress bar sometimes doesn't disappear. --- utils/progress.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/progress.go b/utils/progress.go index f95de8dd..e593cf63 100644 --- a/utils/progress.go +++ b/utils/progress.go @@ -64,7 +64,6 @@ func (p *Progress) InitBar(count int64, isBytes bool) { p.bar.SetUnits(pb.U_BYTES) p.bar.ShowSpeed = true } - p.barShown = false p.bar.Start() } } @@ -111,8 +110,10 @@ func (p *Progress) worker() { } fmt.Print(task.message) case codeProgress: - fmt.Print("\r" + task.message) - p.barShown = true + if p.bar != nil { + fmt.Print("\r" + task.message) + p.barShown = true + } case codeHideProgress: if p.barShown { fmt.Print("\r\033[2K")