From 7ed80bae920bf1851ef07ea5742fb16225353d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 1 Feb 2021 21:24:09 +0200 Subject: Reap proc macro server instances --- crates/proc_macro_api/Cargo.toml | 1 + crates/proc_macro_api/src/process.rs | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'crates/proc_macro_api') diff --git a/crates/proc_macro_api/Cargo.toml b/crates/proc_macro_api/Cargo.toml index 078568cb2..f09726223 100644 --- a/crates/proc_macro_api/Cargo.toml +++ b/crates/proc_macro_api/Cargo.toml @@ -18,3 +18,4 @@ jod-thread = "0.1.1" tt = { path = "../tt", version = "0.0.0" } base_db = { path = "../base_db", version = "0.0.0" } +stdx = { path = "../stdx", version = "0.0.0" } diff --git a/crates/proc_macro_api/src/process.rs b/crates/proc_macro_api/src/process.rs index 6d6ab8888..3ce851fe8 100644 --- a/crates/proc_macro_api/src/process.rs +++ b/crates/proc_macro_api/src/process.rs @@ -10,6 +10,7 @@ use std::{ }; use crossbeam_channel::{bounded, Receiver, Sender}; +use stdx::JodChild; use crate::{ msg::{ErrorCode, Message, Request, Response, ResponseError}, @@ -116,13 +117,7 @@ struct Task { } struct Process { - child: Child, -} - -impl Drop for Process { - fn drop(&mut self) { - let _ = self.child.kill(); - } + child: JodChild, } impl Process { @@ -131,7 +126,7 @@ impl Process { args: impl IntoIterator>, ) -> io::Result { let args: Vec = args.into_iter().map(|s| s.as_ref().into()).collect(); - let child = mk_child(&path, &args)?; + let child = JodChild(mk_child(&path, &args)?); Ok(Process { child }) } -- cgit v1.2.3