Skip to content

Commit b60dc0d

Browse files
Signal end of progress when cleaning
1 parent 8e76c7e commit b60dc0d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/cargo/util/progress.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct Format {
4141
}
4242

4343
/// Which escape code to use for progress reporting.
44-
///
44+
///
4545
/// There is more codes, but we only use these two.
4646
enum ProgressCode {
4747
None,
@@ -50,13 +50,9 @@ enum ProgressCode {
5050

5151
impl std::fmt::Display for ProgressCode {
5252
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53-
let progress = match self {
54-
Self::None => 0,
55-
Self::Normal(v) => *v,
56-
};
57-
let state = match self {
58-
Self::None => 0,
59-
Self::Normal(_) => 1,
53+
let (state, progress) = match self {
54+
Self::None => (0, 0),
55+
Self::Normal(v) => (1, *v),
6056
};
6157
write!(f, "\x1b]9;4;{state};{progress}\x1b\\")
6258
}
@@ -262,6 +258,8 @@ impl<'cfg> State<'cfg> {
262258
if self.last_line.is_some() && !self.config.shell().is_cleared() {
263259
self.config.shell().err_erase_line();
264260
self.last_line = None;
261+
let _ = write!(self.config.shell().err(), "{}", ProgressCode::None);
262+
self.last_pbar = u8::MAX;
265263
}
266264
}
267265

0 commit comments

Comments
 (0)