aboutsummaryrefslogtreecommitdiff
path: root/crates/stdx/src/lib.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-04-20 14:06:20 +0100
committerAleksey Kladov <[email protected]>2021-04-20 16:02:54 +0100
commit1772eb0f1a5c714c91f8ae45cc67cbae6b7ff348 (patch)
treec7498a99c42a9fd30b437cc12e66c5093f8b4d6b /crates/stdx/src/lib.rs
parent1834938d6f37c0d308e407e50514180d0f08d96f (diff)
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
Diffstat (limited to 'crates/stdx/src/lib.rs')
-rw-r--r--crates/stdx/src/lib.rs15
1 files changed, 8 insertions, 7 deletions
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 @@
1//! Missing batteries for standard libraries. 1//! Missing batteries for standard libraries.
2use std::{cmp::Ordering, ops, process, time::Instant}; 2use std::{cmp::Ordering, ops, time::Instant};
3 3
4mod macros; 4mod macros;
5pub mod process;
5pub mod panic_context; 6pub mod panic_context;
6 7
7pub use always_assert::{always, never}; 8pub use always_assert::{always, never};
@@ -179,17 +180,17 @@ where
179} 180}
180 181
181#[repr(transparent)] 182#[repr(transparent)]
182pub struct JodChild(pub process::Child); 183pub struct JodChild(pub std::process::Child);
183 184
184impl ops::Deref for JodChild { 185impl ops::Deref for JodChild {
185 type Target = process::Child; 186 type Target = std::process::Child;
186 fn deref(&self) -> &process::Child { 187 fn deref(&self) -> &std::process::Child {
187 &self.0 188 &self.0
188 } 189 }
189} 190}
190 191
191impl ops::DerefMut for JodChild { 192impl ops::DerefMut for JodChild {
192 fn deref_mut(&mut self) -> &mut process::Child { 193 fn deref_mut(&mut self) -> &mut std::process::Child {
193 &mut self.0 194 &mut self.0
194 } 195 }
195} 196}
@@ -202,9 +203,9 @@ impl Drop for JodChild {
202} 203}
203 204
204impl JodChild { 205impl JodChild {
205 pub fn into_inner(self) -> process::Child { 206 pub fn into_inner(self) -> std::process::Child {
206 // SAFETY: repr transparent 207 // SAFETY: repr transparent
207 unsafe { std::mem::transmute::<JodChild, process::Child>(self) } 208 unsafe { std::mem::transmute::<JodChild, std::process::Child>(self) }
208 } 209 }
209} 210}
210 211