aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/vbauerster/mpb
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/vbauerster/mpb')
-rw-r--r--vendor/github.com/vbauerster/mpb/v7/container_option.go3
-rw-r--r--vendor/github.com/vbauerster/mpb/v7/go.mod10
-rw-r--r--vendor/github.com/vbauerster/mpb/v7/go.sum10
-rw-r--r--vendor/github.com/vbauerster/mpb/v7/progress.go20
-rw-r--r--vendor/github.com/vbauerster/mpb/v7/proxyreader.go3
5 files changed, 16 insertions, 30 deletions
diff --git a/vendor/github.com/vbauerster/mpb/v7/container_option.go b/vendor/github.com/vbauerster/mpb/v7/container_option.go
index bfaa3286a..38239d4fa 100644
--- a/vendor/github.com/vbauerster/mpb/v7/container_option.go
+++ b/vendor/github.com/vbauerster/mpb/v7/container_option.go
@@ -2,7 +2,6 @@ package mpb
import (
"io"
- "io/ioutil"
"sync"
"time"
)
@@ -74,7 +73,7 @@ func WithShutdownNotifier(ch chan struct{}) ContainerOption {
func WithOutput(w io.Writer) ContainerOption {
return func(s *pState) {
if w == nil {
- s.output = ioutil.Discard
+ s.output = io.Discard
s.outputDiscarded = true
return
}
diff --git a/vendor/github.com/vbauerster/mpb/v7/go.mod b/vendor/github.com/vbauerster/mpb/v7/go.mod
deleted file mode 100644
index 66056222e..000000000
--- a/vendor/github.com/vbauerster/mpb/v7/go.mod
+++ /dev/null
@@ -1,10 +0,0 @@
-module github.com/vbauerster/mpb/v7
-
-require (
- github.com/VividCortex/ewma v1.2.0
- github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
- github.com/mattn/go-runewidth v0.0.13
- golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
-)
-
-go 1.14
diff --git a/vendor/github.com/vbauerster/mpb/v7/go.sum b/vendor/github.com/vbauerster/mpb/v7/go.sum
deleted file mode 100644
index 1261e35ca..000000000
--- a/vendor/github.com/vbauerster/mpb/v7/go.sum
+++ /dev/null
@@ -1,10 +0,0 @@
-github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
-github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
-github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
-github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
-github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
-github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
-github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
-github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
-golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
-golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
diff --git a/vendor/github.com/vbauerster/mpb/v7/progress.go b/vendor/github.com/vbauerster/mpb/v7/progress.go
index ea5a0c15e..1dda06e5f 100644
--- a/vendor/github.com/vbauerster/mpb/v7/progress.go
+++ b/vendor/github.com/vbauerster/mpb/v7/progress.go
@@ -254,19 +254,25 @@ func (s *pState) render(cw *cwriter.Writer) error {
}
func (s *pState) flush(cw *cwriter.Writer, height int) error {
+ var wg sync.WaitGroup
var popCount int
rows := make([]io.Reader, 0, height)
pool := make([]*Bar, 0, s.bHeap.Len())
for s.bHeap.Len() > 0 {
- var frameRowsUsed int
+ var usedRows int
b := heap.Pop(&s.bHeap).(*Bar)
frame := <-b.frameCh
for i := len(frame.rows) - 1; i >= 0; i-- {
- if len(rows) == height {
- break
+ if row := frame.rows[i]; len(rows) < height {
+ rows = append(rows, row)
+ usedRows++
+ } else {
+ wg.Add(1)
+ go func() {
+ _, _ = io.Copy(io.Discard, row)
+ wg.Done()
+ }()
}
- rows = append(rows, frame.rows[i])
- frameRowsUsed++
}
if frame.shutdown != 0 {
b.Wait() // waiting for b.done, so it's safe to read b.bs
@@ -278,7 +284,7 @@ func (s *pState) flush(cw *cwriter.Writer, height int) error {
drop = true
} else if s.popCompleted && !b.bs.noPop {
if frame.shutdown > 1 {
- popCount += frameRowsUsed
+ popCount += usedRows
drop = true
} else {
s.popPriority++
@@ -300,10 +306,12 @@ func (s *pState) flush(cw *cwriter.Writer, height int) error {
for i := len(rows) - 1; i >= 0; i-- {
_, err := cw.ReadFrom(rows[i])
if err != nil {
+ wg.Wait()
return err
}
}
+ wg.Wait()
return cw.Flush(len(rows) - popCount)
}
diff --git a/vendor/github.com/vbauerster/mpb/v7/proxyreader.go b/vendor/github.com/vbauerster/mpb/v7/proxyreader.go
index b0dd89d45..51b63ea7a 100644
--- a/vendor/github.com/vbauerster/mpb/v7/proxyreader.go
+++ b/vendor/github.com/vbauerster/mpb/v7/proxyreader.go
@@ -2,7 +2,6 @@ package mpb
import (
"io"
- "io/ioutil"
"time"
)
@@ -76,5 +75,5 @@ func toReadCloser(r io.Reader) io.ReadCloser {
if rc, ok := r.(io.ReadCloser); ok {
return rc
}
- return ioutil.NopCloser(r)
+ return io.NopCloser(r)
}