Skip to content

Commit d04dc01

Browse files
committed
faster writing to stdout/stderr for plumbing commands (#293)
1 parent 50411c8 commit d04dc01

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Diff for: src/shared.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,26 @@ pub mod pretty {
7777
crate::shared::init_env_logger(false);
7878

7979
match (verbose, progress) {
80-
(false, false) => run(progress::DoOrDiscard::from(None), &mut stdout(), &mut stderr()),
80+
(false, false) => {
81+
let stdout = stdout();
82+
let mut stdout_lock = stdout.lock();
83+
let stderr = stderr();
84+
let mut stderr_lock = stderr.lock();
85+
run(progress::DoOrDiscard::from(None), &mut stdout_lock, &mut stderr_lock)
86+
}
8187
(true, false) => {
8288
let progress = crate::shared::progress_tree();
8389
let sub_progress = progress.add_child(name);
8490
#[cfg(not(feature = "prodash-render-line"))]
8591
{
92+
let stdout = stdout();
93+
let mut stdout_lock = stdout.lock();
94+
let stderr = stderr();
95+
let mut stderr_lock = stderr.lock();
8696
run(
8797
progress::DoOrDiscard::from(Some(sub_progress)),
88-
&mut stdout(),
89-
&mut stderr(),
98+
&mut stdout_lock,
99+
&mut stderr_lock,
90100
)
91101
}
92102
#[cfg(feature = "prodash-render-line")]

0 commit comments

Comments
 (0)