Skip to content

Commit

Permalink
assure pretty progress doesn't occlude the output
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jul 1, 2020
1 parent 66553b1 commit 122d69f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/plumbing/pretty.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use git_features::progress;
use gitoxide_core as core;
use std::io::{stderr, stdout};
use std::io::{stderr, stdout, Write};
use structopt::StructOpt;

mod options {
Expand Down Expand Up @@ -93,9 +93,16 @@ pub fn main() -> Result<()> {
progress,
statistics,
} => {
let (_keep, progress) = init_progress("verify-pack", verbose, progress);
core::verify_pack_or_pack_index(path, progress, statistics, stdout(), stderr())
.map(|_| ())
let (handle, progress) = init_progress("verify-pack", verbose, progress);
let mut buf = Vec::new();
let res =
core::verify_pack_or_pack_index(path, progress, statistics, &mut buf, stderr())
.map(|_| ());
// We might have something interesting to show, which would be hidden by the alternate screen if there is a progress TUI
// We know that the printing happens at the end, so this is fine.
drop(handle);
stdout().write_all(&buf)?;
res
}
}?;
Ok(())
Expand Down

0 comments on commit 122d69f

Please sign in to comment.