aboutsummaryrefslogtreecommitdiff
path: root/tests/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib.rs')
-rw-r--r--tests/lib.rs19
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)
+ }
+}