diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-01-10 10:01:53 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-01-10 10:01:53 +0100 |
| commit | 792230e78e75c58f7c3ddfe8ad389625bdceea2c (patch) | |
| tree | c31b1115bafa6bbc0d5b9905a8b928089f777b84 /src/process/mod.rs | |
| parent | b25d54535e8f5b5dce28b2071d6a708cd758d7aa (diff) | |
| download | mullvadvpn-792230e78e75c58f7c3ddfe8ad389625bdceea2c.tar.xz mullvadvpn-792230e78e75c58f7c3ddfe8ad389625bdceea2c.zip | |
Rename MonitorChild, move impl
Diffstat (limited to 'src/process/mod.rs')
| -rw-r--r-- | src/process/mod.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/process/mod.rs b/src/process/mod.rs index 2d06ab4ae0..d3aad8018a 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -98,6 +98,32 @@ fn write_argument(fmt: &mut fmt::Formatter, arg: &str) -> fmt::Result { Ok(()) } + +impl MonitoredChild for ClonableChild { + fn wait(&self) -> io::Result<bool> { + ClonableChild::wait(self).map(|exit_status| exit_status.success()) + } + + fn kill(&self) -> io::Result<()> { + ClonableChild::kill(self) + } + + fn stdout(&mut self) -> Option<ChildStdout> { + self.stdout() + } + + fn stderr(&mut self) -> Option<ChildStderr> { + self.stderr() + } +} + +impl ChildSpawner<ClonableChild> for OpenVpnBuilder { + fn spawn(&mut self) -> io::Result<ClonableChild> { + OpenVpnBuilder::spawn(self).map(|child| child.into_clonable()) + } +} + + #[cfg(test)] mod tests { use net::RemoteAddr; |
