Skip to content

Progressbar regression: label no longer printed if output is not to a tty #1138

Description

@CounterPillow

The progressbar documentation says:

    :param file: the file to write to.  If this is not a terminal then
                 only the label is printed.

However, this is no longer the case with newer click versions. Take the following test script:

#!/usr/bin/env python3
import click
from time import sleep

with click.progressbar(range(100), label="Foo") as pb:
    for _ in pb:
        sleep(0.01)

In click 5.0:

$ ./ayy.py 
Foo  [####################################]  100%          
$ echo "$(./ayy.py)"
Foo
Foo

In click 7.0:

$ ./ayy.py 
Foo  [####################################]  100%          
$ echo "$(./ayy.py)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions