-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
Hello,
I may be missing a point, but it seems that starting and stoping a uiprogress twice make the program panic.
Please find bellow a short test program:
package main
import (
"fmt"
"time"
"github.com/gosuri/uiprogress"
)
func createbar() {
uiprogress.Start()
defer uiprogress.Stop()
// create a new bar and prepend the task progress to the bar
count := 100
bar := uiprogress.AddBar(count).AppendCompleted().PrependElapsed()
bar.PrependFunc(func(b *uiprogress.Bar) string {
return fmt.Sprintf("Task (%d/%d)", b.Current(), count)
})
for i := 0; i < count; i++ {
bar.Incr()
time.Sleep(time.Millisecond * time.Duration(50))
}
time.Sleep(time.Millisecond * time.Duration(500))
}
func main() {
createbar()
createbar()
}The console:
$ go run main.go
Task (100/100) 5s [====================================================================] 100%
Task (1/100) 0s [--------------------------------------------------------------------] 1%
panic: close of closed channel
goroutine 20 [running]:
github.com/gosuri/uiprogress.(*Progress).Listen(0xc00007a1e0)
/Users/jtbonhomme/Developments/golang/src/github.com/gosuri/uiprogress/progress.go:117 +0x12f
created by github.com/gosuri/uiprogress.(*Progress).Start
/Users/jtbonhomme/Developments/golang/src/github.com/gosuri/uiprogress/progress.go:134 +0x3f
exit status 2Metadata
Metadata
Assignees
Labels
No labels