Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
$ black file.py
All done! ✨ 🍰 ✨
1 file left unchanged.
$ black 2>/dev/null file.py
Expected behavior A clear and concise description of what you expected to happen.
$ black file.py
All done! ✨ 🍰 ✨
1 file left unchanged.
$ black 2>/dev/null file.py
All done! ✨ 🍰 ✨
1 file left unchanged.
Environment (please complete the following information):
why?
Why what? Do you not understand why someone might want to differentiate between stdout and stderr? I'm sure there's tons or pubic writing on the matter. Here's the top result google returned to me: https://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout
The Black output in these examples is similar to the diagnostic messages cited in that blog post, and therefore a better fit for stderr than stdout.
Black does use stdout for printing its formatted output:
$ echo '1+2' | black -
1 + 2
reformatted -
All done! ✨ 🍰 ✨
1 file reformatted.
$ echo '1+2' | black - 2>/dev/null
1 + 2
but... its not an error. How does this not fall squarely into stdout territory? Its simply informative output generated by a _successful_ execution of the program. Am I missing something? Apologies if I am.
So I took a look at this. I kind of go both ways here. I personally would like black to respect UNIX philosophies and have non error output go to stdout and all error output to stderr.
Basically there are only 3 main changes (but I have not looked at why the tests are failing completely):
All done! ✨ 🍰 ✨ output to go to stdouterr() partialout click.secho partial to default to stdoutThe failing commit can be seen here: https://github.com/psf/black/commit/b3e5ea576a5b725731f0c6eb69be5534795fffbd
Change the non quiet/verbose success All done! ✨ 🍰 ✨ output to go to stdout
If this change was made, doesn't that break the ability to use Black in a pipeline?
source_generator (eg echo "1+2") | black >generated_source.py
A user doesn't want the generated source to contain "All done!" messages.
The unix philosophy is not just that errors alone go to stderr. All user-readable status messages should go there, to separate them from the data being operated on.
Most helpful comment
Why what? Do you not understand why someone might want to differentiate between stdout and stderr? I'm sure there's tons or pubic writing on the matter. Here's the top result google returned to me: https://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout