From b21a79364a6fdcfc6746a6f938c5b2a2e30128b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Thu, 24 Dec 2020 15:38:40 +0200 Subject: Flush stdout when clearing the progress bar --- crates/rust-analyzer/src/cli/progress_report.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/rust-analyzer/src/cli/progress_report.rs b/crates/rust-analyzer/src/cli/progress_report.rs index bdbe565e6..5a2dc39d5 100644 --- a/crates/rust-analyzer/src/cli/progress_report.rs +++ b/crates/rust-analyzer/src/cli/progress_report.rs @@ -1,7 +1,7 @@ //! A simple progress bar //! //! A single thread non-optimized progress bar -use std::io::Write; +use std::io::{self, Write}; /// A Simple ASCII Progress Bar pub(crate) struct ProgressReport { @@ -97,8 +97,8 @@ impl ProgressReport { } } - let _ = std::io::stdout().write(output.as_bytes()); - let _ = std::io::stdout().flush(); + let _ = io::stdout().write(output.as_bytes()); + let _ = io::stdout().flush(); self.text = text.to_string(); } @@ -115,6 +115,8 @@ impl ProgressReport { let spaces = " ".repeat(self.text.len()); let backspaces = "\x08".repeat(self.text.len()); print!("{}{}{}", backspaces, spaces, backspaces); + let _ = io::stdout().flush(); + self.text = String::new(); } } -- cgit v1.2.3