Skip to content

Commit

Permalink
fix: printing to stdout for commands that don't show progress is grea…
Browse files Browse the repository at this point in the history
…tly improved.

Previously it would have to lock `stdout` on each write, now this is done only once.
  • Loading branch information
Byron committed Apr 25, 2023
1 parent ca8ebdf commit dd14a80
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ pub mod pretty {
crate::shared::init_env_logger();

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();
run(progress::DoOrDiscard::from(None), &mut stdout_lock, &mut stderr())
}
(true, false) => {
use crate::shared::{self, STANDARD_RANGE};
let progress = shared::progress_tree();
Expand Down

0 comments on commit dd14a80

Please sign in to comment.