Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use by default os.StdErr for output #56

Closed
cipriancraciun opened this issue Apr 11, 2020 · 3 comments
Closed

Use by default os.StdErr for output #56

cipriancraciun opened this issue Apr 11, 2020 · 3 comments

Comments

@cipriancraciun
Copy link

I know that with #11 support for specifying the output stream was added, and thus it is technically possible to use os.StdErr.

However given that such a library is most useful in CLI tools and filters (like sed, grep, etc.) that are part of a pipeline, having status printed on os.StdOut by default would take many (at least in the *NIX) world by surprise.

For example today I've tried integrating this library without thinking for a second it would clobber the standard output...

Therefore I would suggest making os.Stderr the default. (At least in a future version like v4 if backward compatibility is a major issue.)

@cipriancraciun
Copy link
Author

Or, if os.StdErr isn't made the default, at least detect if the os.StdOut is actually a TTY, else don't output anything.

@schollz
Copy link
Owner

schollz commented Apr 11, 2020

@cipriancraciun Thanks. I'll leave this open and let people post reactions so I can gauge how others view this. Personally I like going to stdout.

BTW, as mentioned you can set to os.StdErr in options:

bar := progressbar.NewOptions(10, progressbar.OptionSetWriter(os.StdErr))

@schollz
Copy link
Owner

schollz commented May 2, 2020

As of v3.3 the stderr is default for the Default() and DefaultBytes() functions

@schollz schollz closed this as completed May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants