diff --git a/bar.go b/bar.go index 293517c..4991f4f 100644 --- a/bar.go +++ b/bar.go @@ -407,7 +407,7 @@ func (b *Bar) forceRefresh() { var anyOtherRunning bool b.container.traverseBars(func(bar *Bar) bool { - anyOtherRunning = b != bar && !bar.Completed() && !bar.Aborted() + anyOtherRunning = b != bar && bar.isRunning() return !anyOtherRunning }) if !anyOtherRunning { @@ -419,6 +419,18 @@ return } } + } +} + +func (b *Bar) isRunning() bool { + result := make(chan bool) + select { + case b.operateState <- func(s *bState) { + result <- !s.completed && !s.aborted + }: + return <-result + case <-b.done: + return false } }