]> git.lizzy.rs Git - rust.git/commitdiff
Reap proc macro server instances
authorLaurențiu Nicola <lnicola@dend.ro>
Mon, 1 Feb 2021 19:24:09 +0000 (21:24 +0200)
committerLaurențiu Nicola <lnicola@dend.ro>
Mon, 1 Feb 2021 19:24:09 +0000 (21:24 +0200)
Cargo.lock
crates/proc_macro_api/Cargo.toml
crates/proc_macro_api/src/process.rs

index 7f89fc580b046f551e19d024f82416471525a9c8..29ecae98b3be6bfe309e2f83e8fe3bc0a6dec8c1 100644 (file)
@@ -1158,6 +1158,7 @@ dependencies = [
  "log",
  "serde",
  "serde_json",
+ "stdx",
  "tt",
 ]
 
index 078568cb2e2764b210d666492d43c67df4a72271..f0972622303d6dfd9d9299ae4f5212cbae873e90 100644 (file)
@@ -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" }
index 6d6ab8888683964ae20bd42bf52e5eeb1d974283..3ce851fe82ce72fed4bf9ac2272e9e80cf9748bc 100644 (file)
@@ -10,6 +10,7 @@
 };
 
 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 @@ fn run(
         args: impl IntoIterator<Item = impl AsRef<OsStr>>,
     ) -> io::Result<Process> {
         let args: Vec<OsString> = 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 })
     }