Skip to content

Commit a31ee54

Browse files
bors[bot]lnicola
andauthored
Merge #7029
7029: Flush stdout when clearing the progress bar r=lnicola a=lnicola To prevent this from happening: ``` Database loaded 496.24ms, 288mi Crates in this dir: 1 Total modules found: 14 Total declarations: 159 Total functions: 122 Item Collection: 6.02s, 61846mi 122/122 100% processing: archive::sizeTotal expressions: 6592 Expressions of unknown type: 4 (0%) Expressions of partially unknown type: 104 (1%) Type mismatches: 3 Inference: 1.03s, 8622mi Total: 7.05s, 70468mi ``` Co-authored-by: Laurențiu Nicola <[email protected]>
2 parents aebf7ee + b21a793 commit a31ee54

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)