这是indexloc提供的服务,不要输入任何密码
Skip to content

Progress bars get multiplied #39

@matti777

Description

@matti777

My program is creating 2 Bars like so:

        uiprogress.Start()

	bar := uiprogress.AddBar(int(file.Size())).PrependElapsed().
		AppendCompleted()
	bar.PrependFunc(func(b *uiprogress.Bar) string {
		return paddedName
	})
	bar.Fill = '#'
	bar.Head = '#'
	bar.Empty = ' '

        // In a calback, keep calling this until done:
       bar.Set(int(count))

       uiprogress.Stop()

I would expect to see 2 lines of output, one per bar -- instead I am seeing the following:

Bar1   --- [#############################################################       ]  90%
Bar1   --- [####################################################################] 100%
Bar2  --- [#############################################################       ]  90%
Bar1   --- [####################################################################] 100%
Bar2  --- [####################################################################] 100%

I am creating the bars in arbitrary goroutines. Is this an issue? Should all the bars be created in a single goroutine?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions