Merge pull request #4 from raybritton/windows
Update library to support latest versions of Rust and Windows
This commit is contained in:
@@ -45,14 +45,14 @@ impl Connectivity for WiFi {
|
|||||||
.args(&[
|
.args(&[
|
||||||
"wlan",
|
"wlan",
|
||||||
"connect",
|
"connect",
|
||||||
&format!("name={}", *self.connection.unwrap().ssid),
|
&format!("name={}", ssid),
|
||||||
])
|
])
|
||||||
.output()
|
.output()
|
||||||
.map_err(|err| WifiConnectionError::FailedToConnect(format!("{}", err)))?;
|
.map_err(|err| WifiConnectionError::FailedToConnect(format!("{}", err)))?;
|
||||||
|
|
||||||
if !String::from_utf8_lossy(&output.stdout)
|
if !String::from_utf8_lossy(&output.stdout)
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.contains("successfully activated")
|
.contains("completed successfully")
|
||||||
{
|
{
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ impl WifiInterface for Windows {
|
|||||||
.output()
|
.output()
|
||||||
.map_err(|err| WifiError::IoError(err))?;
|
.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.
|
/// Turn on the wireless network adapter.
|
||||||
@@ -64,7 +64,7 @@ impl WifiInterface for Windows {
|
|||||||
|
|
||||||
/// Turn off the wireless network adapter.
|
/// Turn off the wireless network adapter.
|
||||||
fn turn_off() -> Result<(), WifiError> {
|
fn turn_off() -> Result<(), WifiError> {
|
||||||
let _output = Command::new("nmcli")
|
let _output = Command::new("netsh")
|
||||||
.args(&[
|
.args(&[
|
||||||
"interface",
|
"interface",
|
||||||
"set",
|
"set",
|
||||||
|
|||||||
Reference in New Issue
Block a user