diff --git a/bar.go b/bar.go index 4e226e3..869ecf9 100644 --- a/bar.go +++ b/bar.go @@ -371,15 +371,13 @@ } } -// IsRunning reports whether the bar is running, i.e. not yet completed -// and not yet aborted. +// IsRunning reports whether the bar is in running state. 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: + select { + case <-b.ctx.Done(): return false + default: + return true } }