Skip to content

Commit b21a793

Browse files
committed
Flush stdout when clearing the progress bar
1 parent 3d5d21b commit b21a793

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/rust-analyzer/src/cli/progress_report.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! A simple progress bar
22
//!
33
//! A single thread non-optimized progress bar
4-
use std::io::Write;
4+
use std::io::{self, Write};
55

66
/// A Simple ASCII Progress Bar
77
pub(crate) struct ProgressReport {
@@ -97,8 +97,8 @@ impl ProgressReport {
9797
}
9898
}
9999

100-
let _ = std::io::stdout().write(output.as_bytes());
101-
let _ = std::io::stdout().flush();
100+
let _ = io::stdout().write(output.as_bytes());
101+
let _ = io::stdout().flush();
102102
self.text = text.to_string();
103103
}
104104

@@ -115,6 +115,8 @@ impl ProgressReport {
115115
let spaces = " ".repeat(self.text.len());
116116
let backspaces = "\x08".repeat(self.text.len());
117117
print!("{}{}{}", backspaces, spaces, backspaces);
118+
let _ = io::stdout().flush();
119+
118120
self.text = String::new();
119121
}
120122
}

0 commit comments

Comments
 (0)