aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_api
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2021-02-01 19:24:09 +0000
committerLaurenČ›iu Nicola <[email protected]>2021-02-01 19:24:09 +0000
commit7ed80bae920bf1851ef07ea5742fb16225353d7f (patch)
tree06795400e093c04f1b4c02c27403ad85b00f590d /crates/proc_macro_api
parentc0d3e315e33e8d95d064bfe2c276858dd802fd0d (diff)
Reap proc macro server instances
Diffstat (limited to 'crates/proc_macro_api')
-rw-r--r--crates/proc_macro_api/Cargo.toml1
-rw-r--r--crates/proc_macro_api/src/process.rs11
2 files changed, 4 insertions, 8 deletions
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"
18 18
19tt = { path = "../tt", version = "0.0.0" } 19tt = { path = "../tt", version = "0.0.0" }
20base_db = { path = "../base_db", version = "0.0.0" } 20base_db = { path = "../base_db", version = "0.0.0" }
21stdx = { 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::{
10}; 10};
11 11
12use crossbeam_channel::{bounded, Receiver, Sender}; 12use crossbeam_channel::{bounded, Receiver, Sender};
13use stdx::JodChild;
13 14
14use crate::{ 15use crate::{
15 msg::{ErrorCode, Message, Request, Response, ResponseError}, 16 msg::{ErrorCode, Message, Request, Response, ResponseError},
@@ -116,13 +117,7 @@ struct Task {
116} 117}
117 118
118struct Process { 119struct Process {
119 child: Child, 120 child: JodChild,
120}
121
122impl Drop for Process {
123 fn drop(&mut self) {
124 let _ = self.child.kill();
125 }
126} 121}
127 122
128impl Process { 123impl Process {
@@ -131,7 +126,7 @@ impl Process {
131 args: impl IntoIterator<Item = impl AsRef<OsStr>>, 126 args: impl IntoIterator<Item = impl AsRef<OsStr>>,
132 ) -> io::Result<Process> { 127 ) -> io::Result<Process> {
133 let args: Vec<OsString> = args.into_iter().map(|s| s.as_ref().into()).collect(); 128 let args: Vec<OsString> = args.into_iter().map(|s| s.as_ref().into()).collect();
134 let child = mk_child(&path, &args)?; 129 let child = JodChild(mk_child(&path, &args)?);
135 Ok(Process { child }) 130 Ok(Process { child })
136 } 131 }
137 132