diff --git a/progress.go b/progress.go index 76dc168..4174414 100644 --- a/progress.go +++ b/progress.go @@ -306,13 +306,13 @@ go b.render(width) } + return s.flush(cw, height) +} + +func (s *pState) flush(cw *cwriter.Writer, height int) error { wg := new(sync.WaitGroup) - err = s.flush(wg, cw, height) - wg.Wait() - return err -} - -func (s *pState) flush(wg *sync.WaitGroup, cw *cwriter.Writer, height int) error { + defer wg.Wait() // waiting for all s.hm.push to complete + var popCount int s.rows = s.rows[:0]