Skip to content

Commit

Permalink
Signal end of progress when cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
albertlarsan68 committed Dec 21, 2022
1 parent 8e76c7e commit b60dc0d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/cargo/util/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct Format {
}

/// Which escape code to use for progress reporting.
///
///
/// There is more codes, but we only use these two.
enum ProgressCode {
None,
Expand All @@ -50,13 +50,9 @@ enum ProgressCode {

impl std::fmt::Display for ProgressCode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let progress = match self {
Self::None => 0,
Self::Normal(v) => *v,
};
let state = match self {
Self::None => 0,
Self::Normal(_) => 1,
let (state, progress) = match self {
Self::None => (0, 0),
Self::Normal(v) => (1, *v),
};
write!(f, "\x1b]9;4;{state};{progress}\x1b\\")
}
Expand Down Expand Up @@ -262,6 +258,8 @@ impl<'cfg> State<'cfg> {
if self.last_line.is_some() && !self.config.shell().is_cleared() {
self.config.shell().err_erase_line();
self.last_line = None;
let _ = write!(self.config.shell().err(), "{}", ProgressCode::None);
self.last_pbar = u8::MAX;
}
}

Expand Down

0 comments on commit b60dc0d

Please sign in to comment.