mirror of
https://github.com/containers/podman.git
synced 2025-12-03 19:59:39 +08:00
This requires some additional changes to the dependencies since the progress-bar library has been changed to github.com/vbauerster/mpb. Please refer to the following link for the release notes: https://github.com/containers/image/releases/tag/v1.4 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
44 lines
639 B
Go
44 lines
639 B
Go
// +build windows
|
|
|
|
package mpb
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
func (p *Progress) serve(s *pState) {
|
|
|
|
var ticker *time.Ticker
|
|
var refreshCh <-chan time.Time
|
|
|
|
if s.manualRefreshCh == nil {
|
|
ticker = time.NewTicker(s.rr)
|
|
refreshCh = ticker.C
|
|
} else {
|
|
refreshCh = s.manualRefreshCh
|
|
}
|
|
|
|
for {
|
|
select {
|
|
case op := <-p.operateState:
|
|
op(s)
|
|
case <-refreshCh:
|
|
if s.zeroWait {
|
|
if s.manualRefreshCh == nil {
|
|
ticker.Stop()
|
|
}
|
|
if s.shutdownNotifier != nil {
|
|
close(s.shutdownNotifier)
|
|
}
|
|
close(p.done)
|
|
return
|
|
}
|
|
tw, err := s.cw.GetWidth()
|
|
if err != nil {
|
|
tw = s.width
|
|
}
|
|
s.render(tw)
|
|
}
|
|
}
|
|
}
|