Reap proc macro server instances

This commit is contained in:
Laurențiu Nicola 2021-02-01 21:24:09 +02:00
parent c0d3e315e3
commit 7ed80bae92
3 changed files with 5 additions and 8 deletions

1
Cargo.lock generated
View file

@ -1158,6 +1158,7 @@ dependencies = [
"log",
"serde",
"serde_json",
"stdx",
"tt",
]

View 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" }

View file

@ -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<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 })
}