-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cargo doesn't clear line when progress bars force-enabled #9155
Comments
I think this is expected behavior. When you pipe stderr, it disables ANSI codes, so the progress bar uses a carriage-return to clear the line. |
@ehuss I saw this behavior whether I used |
The detection of stderr being a tty or not does seem to be the issue, though: if I change Would it make sense for Cargo to skip checking if stderr is a tty if it's being forced to display a progress bar? Or, alternatively, would it make sense for Cargo to clear the line with spaces rather than the clear-to-EOL escape sequence, if emitting a progress bar but ANSI sequences aren't force-enabled? |
Oh, sorry, I was mistaken. The issue is this line: Line 189 in ab64d13
Yea, I think instead of checking for tty, it needs to check if color is enabled. If not enabled, it can maybe clear with spaces? If color is enabled, then it can use ANSI to clear. I think Windows can just always use spaces. |
#9231 partly fixes this, for the case where progress and color are both force-enabled. |
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:
Incorrect behavior, with stdout/stderr going to a pipe:
(Letting it run longer shows that the
===>
part of the progress bar doesn't get cleared either.)The text was updated successfully, but these errors were encountered: