Skip to content

Cargo doesn't clear line when progress bars force-enabled #9155

Open
@joshtriplett

Description

@joshtriplett

When building with CARGO_TERM_PROGRESS_WIDTH=100 CARGO_TERM_PROGRESS_WHEN=always cargo build, with stdout/stderr directed somewhere other than a tty, cargo doesn't seem to clear to the end of the line when overwriting a line containing a progress bar.

Correct behavior, with stdout/stderr going to a terminal:

~/src/cargo$ CARGO_TERM_PROGRESS_WIDTH=100 CARGO_TERM_PROGRESS_WHEN=always cargo build
   Compiling libc v0.2.86
   Compiling pkg-config v0.3.16
   Compiling cfg-if v0.1.10
   Compiling autocfg v0.1.6
   Compiling lazy_static v1.4.0
   Compiling proc-macro2 v1.0.5
    Building [                                                         ] 2/153: libc(build.rs),...

Incorrect behavior, with stdout/stderr going to a pipe:

~/src/cargo$ CARGO_TERM_PROGRESS_WIDTH=100 CARGO_TERM_PROGRESS_WHEN=always cargo build 2>&1 | cat
   Compiling libc v0.2.86
   Compiling pkg-config v0.3.16
   Compiling cfg-if v0.1.10
   Compiling autocfg v0.1.6
   Compiling lazy_static v1.4.0                                        ] 0/153: pkg-config, cfg...
   Compiling proc-macro2 v1.0.5                                        ] 1/153: pkg-config, aut...
   Compiling unicode-xid v0.2.0                                        ] 2/153: proc-macro2(bui...
   Compiling syn v1.0.5                                                ] 3/153: proc-macro2(bui...
   Compiling serde v1.0.101                                            ] 4/153: proc-macro2(bui...
   Compiling memchr v2.2.1                                             ] 5/153: proc-macro2(bui...
    Building [=>                                                       ] 6/153: pkg-config, ser...

(Letting it run longer shows that the ===> part of the progress bar doesn't get cleared either.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-console-outputArea: Terminal output, colors, progress bar, etc.C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions