diff options
author | Laurențiu Nicola <[email protected]> | 2021-02-01 19:24:09 +0000 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2021-02-01 19:24:09 +0000 |
commit | 7ed80bae920bf1851ef07ea5742fb16225353d7f (patch) | |
tree | 06795400e093c04f1b4c02c27403ad85b00f590d /crates/proc_macro_api/src | |
parent | c0d3e315e33e8d95d064bfe2c276858dd802fd0d (diff) |
Reap proc macro server instances
Diffstat (limited to 'crates/proc_macro_api/src')
-rw-r--r-- | crates/proc_macro_api/src/process.rs | 11 |
1 files changed, 3 insertions, 8 deletions
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 | ||