ok/jj
1
0
Fork 0
forked from mirrors/jj

ui: ensure progress completion output is flushed

Since stdout is wrapped with LineWriter, we need to explicitly flush the
output. Otherwise the snapshot progress would persist until newline character
is printed.

It might also be better to send progress to stderr?
This commit is contained in:
Yuya Nishihara 2023-06-12 17:42:07 +09:00
parent 738f99ddf1
commit 6c1e39f3ff
2 changed files with 2 additions and 0 deletions

View file

@ -37,6 +37,7 @@ impl Progress {
if progress.overall == 1.0 {
write!(ui, "\r{}", Clear(ClearType::CurrentLine))?;
ui.flush()?;
return Ok(());
}

View file

@ -331,5 +331,6 @@ pub struct OutputGuard {
impl Drop for OutputGuard {
fn drop(&mut self) {
_ = self.output.write_all(self.text.as_bytes());
_ = self.output.flush();
}
}