diff options
author | Melody Horn <melody@boringcactus.com> | 2021-11-12 22:38:39 -0700 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-11-12 22:38:39 -0700 |
commit | f79b75710167088e2031a82a94a8d127fbb16a1f (patch) | |
tree | ffbbd167c34864d92b1d1e0a3b40da77e0b06874 /tests/lib.rs | |
parent | fad6b7b755b788ca0d9113999faa8fb0d6f89ad0 (diff) | |
download | narchttpd-f79b75710167088e2031a82a94a8d127fbb16a1f.tar.gz narchttpd-f79b75710167088e2031a82a94a8d127fbb16a1f.zip |
god is dead and we have killed him.
Diffstat (limited to 'tests/lib.rs')
-rw-r--r-- | tests/lib.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib.rs b/tests/lib.rs new file mode 100644 index 0000000..50d4fa7 --- /dev/null +++ b/tests/lib.rs @@ -0,0 +1,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) + } +} |