aboutsummaryrefslogtreecommitdiff
path: root/tests/lib.rs
blob: 50d4fa72683a69a86156a94ce721a05b86724d69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::process::Child;

pub struct KillOnDrop(Child);

impl Drop for KillOnDrop {
    fn drop(&mut self) {
        self.0.kill().unwrap();
    }
}

pub trait ChildExt {
    fn kill_on_drop(self) -> KillOnDrop;
}

impl ChildExt for Child {
    fn kill_on_drop(self) -> KillOnDrop {
        KillOnDrop(self)
    }
}