mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
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
This commit is contained in:
parent
1834938d6f
commit
1772eb0f1a
5 changed files with 329 additions and 64 deletions
|
@ -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::<JodChild, process::Child>(self) }
|
||||
unsafe { std::mem::transmute::<JodChild, std::process::Child>(self) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue