Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/flycheck/src/command.rs')
| -rw-r--r-- | crates/flycheck/src/command.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/flycheck/src/command.rs b/crates/flycheck/src/command.rs index 8ba7018316..38c7c81f57 100644 --- a/crates/flycheck/src/command.rs +++ b/crates/flycheck/src/command.rs @@ -9,8 +9,8 @@ use std::{ process::{ChildStderr, ChildStdout, Command, Stdio}, }; -use command_group::{CommandGroup, GroupChild}; use crossbeam_channel::Sender; +use process_wrap::std::{StdChildWrapper, StdCommandWrap}; use stdx::process::streaming_output; /// Cargo output is structured as a one JSON per line. This trait abstracts parsing one line of @@ -85,7 +85,7 @@ impl<T: ParseFromLine> CargoActor<T> { } } -struct JodGroupChild(GroupChild); +struct JodGroupChild(Box<dyn StdChildWrapper>); impl Drop for JodGroupChild { fn drop(&mut self) { @@ -119,14 +119,20 @@ impl<T> fmt::Debug for CommandHandle<T> { impl<T: ParseFromLine> CommandHandle<T> { pub(crate) fn spawn(mut command: Command, sender: Sender<T>) -> std::io::Result<Self> { command.stdout(Stdio::piped()).stderr(Stdio::piped()).stdin(Stdio::null()); - let mut child = command.group_spawn().map(JodGroupChild)?; let program = command.get_program().into(); let arguments = command.get_args().map(|arg| arg.into()).collect::<Vec<OsString>>(); let current_dir = command.get_current_dir().map(|arg| arg.to_path_buf()); - let stdout = child.0.inner().stdout.take().unwrap(); - let stderr = child.0.inner().stderr.take().unwrap(); + let mut child = StdCommandWrap::from(command); + #[cfg(unix)] + child.wrap(process_wrap::std::ProcessSession); + #[cfg(windows)] + child.wrap(process_wrap::std::JobObject); + let mut child = child.spawn().map(JodGroupChild)?; + + let stdout = child.0.stdout().take().unwrap(); + let stderr = child.0.stderr().take().unwrap(); let actor = CargoActor::<T>::new(sender, stdout, stderr); let thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker) |