schollz / progressbar

A really basic thread-safe progress bar for Golang applications

Home Page:https://pkg.go.dev/github.com/schollz/progressbar/v3?tab=doc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spinner not working

lukasmalkmus opened this issue · comments

The spinner is not working for me. I try to use it when reading from os.Stdin:

r = progressbar.NewReader(os.Stdin, progressbar.DefaultBytes(-1, "Test"))

The resulting progress bar doesn't "spin", there is just a static character. Also the \n is not appended after completion.

I'm running this in zsh on macOS.

commented

Does it work with the download-unkown example in this repo?

Yes, it works with the example. To verify again, I wrote this sample:

package main

import (
	"compress/gzip"
	"io"
	"os"

	"github.com/schollz/progressbar/v3"
)

func main() {
	bar := progressbar.DefaultBytes(
		-1,
		"extracting",
	)

	gzr, _ := gzip.NewReader(os.Stdin)
	defer gzr.Close()

	io.Copy(io.MultiWriter(os.Stdout, bar), gzr)
}

Ran after running your example: cat go1.14.2.src.tar.gz | go run main.go > go1.14.2.src.tar

And it works, too. I don't know if this was resolved by additional commits to the repository since I opened the issue or I made a mistake back in November. However, I can't remember what I did back then :)

Feel free to close this issue and don't hesitate do ask if you want me to do additional tests.