diff options
| author | David Lönnhager <david.l@mullvad.net> | 2020-03-24 13:23:29 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2020-03-24 19:58:54 +0100 |
| commit | 21cef88436fff462aeed077abad43ad8a6b0bb0a (patch) | |
| tree | e3214473ab690b9d3ab7b57f22d8b3d058862782 | |
| parent | fe896be6b01e8aa02922a3677c4927098a1a4e27 (diff) | |
| download | mullvadvpn-21cef88436fff462aeed077abad43ad8a6b0bb0a.tar.xz mullvadvpn-21cef88436fff462aeed077abad43ad8a6b0bb0a.zip | |
Fail on non-zero exit statuses in RouteManager
| -rw-r--r-- | talpid-core/src/routing/linux/mod.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/talpid-core/src/routing/linux/mod.rs b/talpid-core/src/routing/linux/mod.rs index 9c2f688b84..cdc57c87e1 100644 --- a/talpid-core/src/routing/linux/mod.rs +++ b/talpid-core/src/routing/linux/mod.rs @@ -252,7 +252,18 @@ impl RouteManagerImpl { fn run_cmd(mut cmd: Command, err: impl Fn(io::Error) -> Error) -> Result<()> { log::trace!("running cmd - {:?}", &cmd); - cmd.output().map_err(err).map(|_| ()) + let status = cmd.status().map_err(|e| err(e))?; + match status.code() { + Some(0) => Ok(()), + Some(i) => Err(err(io::Error::new( + io::ErrorKind::Other, + format!("exit status {}", i), + ))), + None => Err(err(io::Error::new( + io::ErrorKind::Other, + "interrupted by signal", + ))), + } } fn get_default_routes_inner(ip_version: IpVersion) -> Result<Vec<Route>> { |
