diff --git a/bar.go b/bar.go index 0fd9522..f4b52e0 100644 --- a/bar.go +++ b/bar.go @@ -294,7 +294,8 @@ // Abort interrupts bar's running goroutine. Abort won't be engaged // if bar is already in complete state. If drop is true bar will be -// removed as well. +// removed as well. To make sure that bar has been removed call +// (*Bar).Wait method. func (b *Bar) Abort(drop bool) { select { case b.operateState <- func(s *bState) { @@ -305,7 +306,6 @@ s.dropOnComplete = drop go b.forceRefresh() }: - <-b.done case <-b.done: } } diff --git a/progress_test.go b/progress_test.go index 90ed3c4..2eaba5c 100644 --- a/progress_test.go +++ b/progress_test.go @@ -67,6 +67,7 @@ if abortCalledTimes != 1 { t.Errorf("Expected abortCalledTimes: %d, got: %d\n", 1, abortCalledTimes) } + b.Wait() count := p.BarCount() if count != 1 { t.Errorf("BarCount want: %d, got: %d\n", 1, count)