Skip to content

Commit b929d05

Browse files
committed
Add drop for process
1 parent e7d1549 commit b929d05

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/ra_proc_macro/src/process.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ struct Process {
4545
child: Child,
4646
}
4747

48+
impl Drop for Process {
49+
fn drop(&mut self) {
50+
let _ = self.child.kill();
51+
}
52+
}
53+
4854
impl Process {
4955
fn run(process_path: &Path) -> Result<Process, io::Error> {
5056
let child = Command::new(process_path.clone())
@@ -186,8 +192,6 @@ fn client_loop(task_rx: Receiver<Task>, mut process: Process) {
186192
result_tx.send(res).unwrap();
187193
}
188194
}
189-
190-
let _ = process.child.kill();
191195
}
192196

193197
fn send_request(

0 commit comments

Comments
 (0)