cleo icon indicating copy to clipboard operation
cleo copied to clipboard

Why progress-indicator defaults the output to standard error instead of standard output?

Open gmichaeljaison opened this issue 3 years ago • 1 comments

https://github.com/sdispater/clikit/blob/master/src/clikit/ui/components/progress_indicator.py#L31 https://github.com/sdispater/cleo/blob/master/cleo/ui/progress_indicator.py#L35

class ProgressIndicator(object):

    def __init__(self, ...):
        if isinstance(io, IO):
            io = io.error_output

I could not infer the reasoning behind this. I would think stderr should be empty if there is no error.

gmichaeljaison avatar Sep 16 '21 16:09 gmichaeljaison

This is pretty common for progress bars. See tqdm:

Customisable progressbar decorator for iterators. Includes a default range iterator printing to stderr.

POSIX defines stderr as "for writing diagnostic output": https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html

Notably, this does not say "for writing application errors." I would think the progress of the task you're doing could be considered "diagnostic output."

eugenetriguba avatar Mar 30 '22 02:03 eugenetriguba

I believe the original question has been answered. For anyone not satisfied, please open a new issue.

Secrus avatar Sep 05 '22 19:09 Secrus