Cargo doesn't clear line when progress bars force-enabled
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
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.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with CARGO_TERM_PROGRESS_WIDTH=100 and CARGO_TERM_PROGRESS_WHEN=always while piping cargo build output through cat. Trace the progress-bar output handling for non-TTY streams; done means overwritten lines clear all trailing characters, including progress-bar remnants, when output is redirected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100