From 1772eb0f1a5c714c91f8ae45cc67cbae6b7ff348 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 20 Apr 2021 16:06:20 +0300 Subject: fix: no longer get stuck on windows reading both stdout & stderr is a common gotcha, you need to drain them concurrently to avoid deadlocks. Not sure why I didn't do the right thing from the start. Seems like I assumed the stderr is short? That's not the case when cargo spams `compiling xyz` messages --- crates/stdx/src/lib.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'crates/stdx/src/lib.rs') diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index b0a18d58d..e3eb10915 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs @@ -1,7 +1,8 @@ //! Missing batteries for standard libraries. -use std::{cmp::Ordering, ops, process, time::Instant}; +use std::{cmp::Ordering, ops, time::Instant}; mod macros; +pub mod process; pub mod panic_context; pub use always_assert::{always, never}; @@ -179,17 +180,17 @@ where } #[repr(transparent)] -pub struct JodChild(pub process::Child); +pub struct JodChild(pub std::process::Child); impl ops::Deref for JodChild { - type Target = process::Child; - fn deref(&self) -> &process::Child { + type Target = std::process::Child; + fn deref(&self) -> &std::process::Child { &self.0 } } impl ops::DerefMut for JodChild { - fn deref_mut(&mut self) -> &mut process::Child { + fn deref_mut(&mut self) -> &mut std::process::Child { &mut self.0 } } @@ -202,9 +203,9 @@ impl Drop for JodChild { } impl JodChild { - pub fn into_inner(self) -> process::Child { + pub fn into_inner(self) -> std::process::Child { // SAFETY: repr transparent - unsafe { std::mem::transmute::(self) } + unsafe { std::mem::transmute::(self) } } } -- cgit v1.2.3