Skip to content

Commit

Permalink
faster writing to stdout/stderr for plumbing commands (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Feb 22, 2022
1 parent 50411c8 commit d04dc01
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,26 @@ pub mod pretty {
crate::shared::init_env_logger(false);

match (verbose, progress) {
(false, false) => run(progress::DoOrDiscard::from(None), &mut stdout(), &mut stderr()),
(false, false) => {
let stdout = stdout();
let mut stdout_lock = stdout.lock();
let stderr = stderr();
let mut stderr_lock = stderr.lock();
run(progress::DoOrDiscard::from(None), &mut stdout_lock, &mut stderr_lock)
}
(true, false) => {
let progress = crate::shared::progress_tree();
let sub_progress = progress.add_child(name);
#[cfg(not(feature = "prodash-render-line"))]
{
let stdout = stdout();
let mut stdout_lock = stdout.lock();
let stderr = stderr();
let mut stderr_lock = stderr.lock();
run(
progress::DoOrDiscard::from(Some(sub_progress)),
&mut stdout(),
&mut stderr(),
&mut stdout_lock,
&mut stderr_lock,
)
}
#[cfg(feature = "prodash-render-line")]
Expand Down

0 comments on commit d04dc01

Please sign in to comment.