summaryrefslogtreecommitdiffstats
path: root/stdout
diff options
context:
space:
mode:
Diffstat (limited to 'stdout')
-rw-r--r--stdout/stdout.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/stdout/stdout.go b/stdout/stdout.go
index 647e243..8d728fe 100644
--- a/stdout/stdout.go
+++ b/stdout/stdout.go
@@ -202,15 +202,18 @@ func (ui *UI) updateProgress() {
progressRunes := []rune(`⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧`)
- progress := ui.analyzer.GetProgress()
+ progressChan := ui.analyzer.GetProgressChan()
+ doneChan := ui.analyzer.GetDoneChan()
+
+ var progress analyze.CurrentProgress
i := 0
for {
- progress.Mutex.Lock()
-
fmt.Fprint(ui.output, emptyRow)
- if progress.Done {
+ select {
+ case progress = <-progressChan:
+ case <-doneChan:
fmt.Fprint(ui.output, "\r")
return
}
@@ -221,7 +224,6 @@ func (ui *UI) updateProgress() {
ui.red.Sprint(progress.ItemCount)+
" size: "+
ui.formatSize(progress.TotalSize))
- progress.Mutex.Unlock()
time.Sleep(100 * time.Millisecond)
i++