From fbe274cffc61dc1bc01e833889f9d3bf6ecd0642 Mon Sep 17 00:00:00 2001 From: luo-cheng-xi Date: Sat, 21 Sep 2024 22:32:18 -0400 Subject: [PATCH] fix:check whether the progressbar is visible before start the spinner change goroutine. --- progressbar.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/progressbar.go b/progressbar.go index cf14cbe..9a1e4c4 100644 --- a/progressbar.go +++ b/progressbar.go @@ -396,6 +396,9 @@ func NewOptions64(max int64, options ...Option) *ProgressBar { // if the render time interval attribute is set if b.config.spinnerChangeInterval != 0 { go func() { + if b.config.invisible { + return + } ticker := time.NewTicker(b.config.spinnerChangeInterval) defer ticker.Stop() for {