diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-01 19:25:00 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-01 19:25:00 +0000 |
commit | 379b6775598659f66aa8b438cdb3d19aa322a2f4 (patch) | |
tree | 06795400e093c04f1b4c02c27403ad85b00f590d | |
parent | c0d3e315e33e8d95d064bfe2c276858dd802fd0d (diff) | |
parent | 7ed80bae920bf1851ef07ea5742fb16225353d7f (diff) |
Merge #7512
7512: Reap proc macro server instances r=lnicola a=lnicola
Fixes #7510, but not the root cause.
Co-authored-by: Laurențiu Nicola <[email protected]>
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | crates/proc_macro_api/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/proc_macro_api/src/process.rs | 11 |
3 files changed, 5 insertions, 8 deletions
diff --git a/Cargo.lock b/Cargo.lock index 7f89fc580..29ecae98b 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -1158,6 +1158,7 @@ dependencies = [ | |||
1158 | "log", | 1158 | "log", |
1159 | "serde", | 1159 | "serde", |
1160 | "serde_json", | 1160 | "serde_json", |
1161 | "stdx", | ||
1161 | "tt", | 1162 | "tt", |
1162 | ] | 1163 | ] |
1163 | 1164 | ||
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 | ||
19 | tt = { path = "../tt", version = "0.0.0" } | 19 | tt = { path = "../tt", version = "0.0.0" } |
20 | base_db = { path = "../base_db", version = "0.0.0" } | 20 | base_db = { path = "../base_db", version = "0.0.0" } |
21 | 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::{ | |||
10 | }; | 10 | }; |
11 | 11 | ||
12 | use crossbeam_channel::{bounded, Receiver, Sender}; | 12 | use crossbeam_channel::{bounded, Receiver, Sender}; |
13 | use stdx::JodChild; | ||
13 | 14 | ||
14 | use crate::{ | 15 | use 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 | ||
118 | struct Process { | 119 | struct Process { |
119 | child: Child, | 120 | child: JodChild, |
120 | } | ||
121 | |||
122 | impl Drop for Process { | ||
123 | fn drop(&mut self) { | ||
124 | let _ = self.child.kill(); | ||
125 | } | ||
126 | } | 121 | } |
127 | 122 | ||
128 | impl Process { | 123 | impl 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 | ||