diff options
author | Edwin Cheng <[email protected]> | 2020-03-31 14:25:52 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-03-31 15:20:19 +0100 |
commit | b929d05c74702f44d2d59eede5e3379c6b725b4f (patch) | |
tree | d59cb071559dd7f964169bb6465962ecb85482eb /crates/ra_proc_macro/src | |
parent | e7d1549e1366c97ce6437168a99470d5dd1806c9 (diff) |
Add drop for process
Diffstat (limited to 'crates/ra_proc_macro/src')
-rw-r--r-- | crates/ra_proc_macro/src/process.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ra_proc_macro/src/process.rs b/crates/ra_proc_macro/src/process.rs index 3e8dd4314..07dc1bf9e 100644 --- a/crates/ra_proc_macro/src/process.rs +++ b/crates/ra_proc_macro/src/process.rs | |||
@@ -45,6 +45,12 @@ struct Process { | |||
45 | child: Child, | 45 | child: Child, |
46 | } | 46 | } |
47 | 47 | ||
48 | impl Drop for Process { | ||
49 | fn drop(&mut self) { | ||
50 | let _ = self.child.kill(); | ||
51 | } | ||
52 | } | ||
53 | |||
48 | impl Process { | 54 | impl Process { |
49 | fn run(process_path: &Path) -> Result<Process, io::Error> { | 55 | fn run(process_path: &Path) -> Result<Process, io::Error> { |
50 | let child = Command::new(process_path.clone()) | 56 | let child = Command::new(process_path.clone()) |
@@ -186,8 +192,6 @@ fn client_loop(task_rx: Receiver<Task>, mut process: Process) { | |||
186 | result_tx.send(res).unwrap(); | 192 | result_tx.send(res).unwrap(); |
187 | } | 193 | } |
188 | } | 194 | } |
189 | |||
190 | let _ = process.child.kill(); | ||
191 | } | 195 | } |
192 | 196 | ||
193 | fn send_request( | 197 | fn send_request( |