Fix unix warnings

This commit is contained in:
caesay
2024-02-26 10:55:59 +00:00
parent cf1472c819
commit 40190504dd
4 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,4 @@
#![allow(unused_variables)]
use core::panic;
use semver;
use std::process::Command;
@@ -33,7 +32,9 @@ fn main() {
.unwrap();
}
#[cfg(target_os = "windows")]
fn link_locksmith() {
use core::panic;
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if arch == "x86_64" {
println!("cargo:rustc-link-lib=UpdateLocksmith_x64");

View File

@@ -47,6 +47,7 @@ pub fn download_url_as_string(url: &str) -> Result<String> {
}
fn get_download_agent() -> Result<ureq::Agent> {
#[allow(unused_mut)]
let mut tls_builder = native_tls::TlsConnector::builder();
#[cfg(target_os = "windows")]

View File

@@ -5,10 +5,11 @@ use std::{path::Path, path::PathBuf, process::Command as Process, time::Duration
pub fn wait_for_pid_to_exit(pid: u32, ms_to_wait: u32) -> Result<()> {
info!("Waiting {}ms for process ({}) to exit.", ms_to_wait, pid);
let mut handle = waitpid_any::WaitHandle::open(pid)?;
let mut handle = waitpid_any::WaitHandle::open(pid.try_into()?)?;
let result = handle.wait_timeout(Duration::from_millis(ms_to_wait as u64))?;
if result.is_some() {
info!("Parent process exited.");
Ok(())
} else {
bail!("Parent process timed out.");
}

View File

@@ -6,10 +6,11 @@ use std::{path::Path, path::PathBuf, process::Command as Process, time::Duration
pub fn wait_for_pid_to_exit(pid: u32, ms_to_wait: u32) -> Result<()> {
info!("Waiting {}ms for process ({}) to exit.", ms_to_wait, pid);
let mut handle = waitpid_any::WaitHandle::open(pid)?;
let mut handle = waitpid_any::WaitHandle::open(pid.try_into()?)?;
let result = handle.wait_timeout(Duration::from_millis(ms_to_wait as u64))?;
if result.is_some() {
info!("Parent process exited.");
Ok(())
} else {
bail!("Parent process timed out.");
}