diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-09-25 14:24:53 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-09-25 14:24:53 +0200 |
| commit | 1c8feec15fff3e411653df7c803b314af8a20b6f (patch) | |
| tree | 12929c7de0535e75ede874ad729ae216a09133a0 | |
| parent | 9b5c05408b3589751239cf8363a2c190c7f4371e (diff) | |
| download | mullvadvpn-1c8feec15fff3e411653df7c803b314af8a20b6f.tar.xz mullvadvpn-1c8feec15fff3e411653df7c803b314af8a20b6f.zip | |
Add support for logging to file for OpenVpnCommand
| -rw-r--r-- | talpid-core/src/process/openvpn.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/talpid-core/src/process/openvpn.rs b/talpid-core/src/process/openvpn.rs index 3398a9baa9..ac3e5911b1 100644 --- a/talpid-core/src/process/openvpn.rs +++ b/talpid-core/src/process/openvpn.rs @@ -37,6 +37,7 @@ pub struct OpenVpnCommand { user_pass_path: Option<PathBuf>, ca: Option<PathBuf>, plugin: Option<(PathBuf, Vec<String>)>, + log: Option<PathBuf>, } impl OpenVpnCommand { @@ -50,6 +51,7 @@ impl OpenVpnCommand { user_pass_path: None, ca: None, plugin: None, + log: None, } } @@ -84,6 +86,12 @@ impl OpenVpnCommand { self } + /// Sets a log file path. + pub fn log<P: AsRef<Path>>(&mut self, path: P) -> &mut Self { + self.log = Some(path.as_ref().to_path_buf()); + self + } + /// Build a runnable expression from the current state of the command. pub fn build(&self) -> duct::Expression { debug!("Building expression: {}", &self); @@ -113,6 +121,11 @@ impl OpenVpnCommand { args.extend(plugin_args.iter().map(OsString::from)); } + if let Some(ref path) = self.log { + args.push(OsString::from("--log")); + args.push(OsString::from(path)) + } + args.extend(Self::security_arguments().iter().map(OsString::from)); args |
