diff --git a/progress.go b/progress.go index 1a9dc9a..f8d5415 100644 --- a/progress.go +++ b/progress.go @@ -30,6 +30,7 @@ operateState chan func(*pState) done chan struct{} forceRefresh chan time.Time + once sync.Once dlogger *log.Logger } @@ -205,10 +206,14 @@ // wait for bars to quit, if any p.bwg.Wait() - close(p.done) + p.once.Do(p.shutdown) // wait for container to quit p.cwg.Wait() +} + +func (p *Progress) shutdown() { + close(p.done) } func (p *Progress) serve(s *pState, cw *cwriter.Writer) {