From ce9cbe723d435a98e01c2953a652af049a77cce3 Mon Sep 17 00:00:00 2001 From: Ray Britton Date: Mon, 17 Aug 2020 21:03:55 +0100 Subject: [PATCH 1/2] Update library to support latest versions of Rust and Windows --- src/connectivity/providers/windows.rs | 4 ++-- src/platforms/windows.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/connectivity/providers/windows.rs b/src/connectivity/providers/windows.rs index d6937ad..7e77108 100644 --- a/src/connectivity/providers/windows.rs +++ b/src/connectivity/providers/windows.rs @@ -45,14 +45,14 @@ impl Connectivity for WiFi { .args(&[ "wlan", "connect", - &format!("name={}", *self.connection.unwrap().ssid), + &format!("name={}", ssid), ]) .output() .map_err(|err| WifiConnectionError::FailedToConnect(format!("{}", err)))?; if !String::from_utf8_lossy(&output.stdout) .as_ref() - .contains("successfully activated") + .contains("completed successfully") { return Ok(false); } diff --git a/src/platforms/windows.rs b/src/platforms/windows.rs index 7397b8f..a6c562f 100644 --- a/src/platforms/windows.rs +++ b/src/platforms/windows.rs @@ -43,7 +43,7 @@ impl WifiInterface for Windows { .output() .map_err(|err| WifiError::IoError(err))?; - Ok(!String::from_utf8_lossy(&output.stdout).contains("disconnected")) + Ok(!String::from_utf8_lossy(&output.stdout).contains("There is no wireless interface")) } /// Turn on the wireless network adapter. From ef9c40613890dd9e0adc785e62e7e0da0cb004ef Mon Sep 17 00:00:00 2001 From: Ray Britton Date: Wed, 19 Aug 2020 20:55:07 +0100 Subject: [PATCH 2/2] Use correct program name for windows --- src/platforms/windows.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/windows.rs b/src/platforms/windows.rs index a6c562f..4e05273 100644 --- a/src/platforms/windows.rs +++ b/src/platforms/windows.rs @@ -64,7 +64,7 @@ impl WifiInterface for Windows { /// Turn off the wireless network adapter. fn turn_off() -> Result<(), WifiError> { - let _output = Command::new("nmcli") + let _output = Command::new("netsh") .args(&[ "interface", "set",