Skip to content

Commit e41b405

Browse files
committed
fix silent mode
1 parent 24993fc commit e41b405

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

main.go

+14-13
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,26 @@ func realMain() int {
6565

6666
redisPassword := os.Getenv("REDISDUMPGO_AUTH")
6767

68-
var progressNotifs chan redisdump.ProgressNotification
68+
progressNotifs := make(chan redisdump.ProgressNotification)
6969
var wg sync.WaitGroup
70-
if !(*silent) {
71-
wg.Add(1)
70+
wg.Add(1)
7271

73-
progressNotifs = make(chan redisdump.ProgressNotification)
74-
defer func() {
75-
close(progressNotifs)
76-
wg.Wait()
72+
defer func() {
73+
close(progressNotifs)
74+
wg.Wait()
75+
if !(*silent) {
7776
fmt.Fprint(os.Stderr, "\n")
78-
}()
77+
}
78+
}()
7979

80-
go func() {
81-
for n := range progressNotifs {
80+
go func() {
81+
for n := range progressNotifs {
82+
if !(*silent) {
8283
drawProgressBar(os.Stderr, n.Done, n.Total, 50)
8384
}
84-
wg.Done()
85-
}()
86-
}
85+
}
86+
wg.Done()
87+
}()
8788

8889
logger := log.New(os.Stdout, "", 0)
8990
if db == nil {

0 commit comments

Comments
 (0)