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:
parent
738f99ddf1
commit
6c1e39f3ff
2 changed files with 2 additions and 0 deletions
|
@ -37,6 +37,7 @@ impl Progress {
|
||||||
|
|
||||||
if progress.overall == 1.0 {
|
if progress.overall == 1.0 {
|
||||||
write!(ui, "\r{}", Clear(ClearType::CurrentLine))?;
|
write!(ui, "\r{}", Clear(ClearType::CurrentLine))?;
|
||||||
|
ui.flush()?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,5 +331,6 @@ pub struct OutputGuard {
|
||||||
impl Drop for OutputGuard {
|
impl Drop for OutputGuard {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
_ = self.output.write_all(self.text.as_bytes());
|
_ = self.output.write_all(self.text.as_bytes());
|
||||||
|
_ = self.output.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue