From 5b2fc6d56d5ad7688c3f39dc1524243225ae0908 Mon Sep 17 00:00:00 2001 From: nxshock Date: Mon, 7 Mar 2022 16:10:43 +0500 Subject: [PATCH] Do now print new line if no progress requested --- gwp.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gwp.go b/gwp.go index a9aae4b..ab960eb 100644 --- a/gwp.go +++ b/gwp.go @@ -48,10 +48,16 @@ func New(threadCount int) *WorkerPool { tickerCalculateEta.Stop() }() - fmt.Fprintf(os.Stderr, endLine) + newLined := false + for { select { case <-tickerUpdateText.C: + if !newLined { + fmt.Fprintf(os.Stderr, endLine) + newLined = true + } + workerPool.printProgress() case <-tickerCalculateEta.C: workerPool.currentSpeed = float64(workerPool.processedCount-prevPos) * float64(time.Second) / float64(time.Now().Sub(prevTime))