mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Fix unix warnings
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
use core::panic;
|
|
||||||
use semver;
|
use semver;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
@@ -33,7 +32,9 @@ fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
fn link_locksmith() {
|
fn link_locksmith() {
|
||||||
|
use core::panic;
|
||||||
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
||||||
if arch == "x86_64" {
|
if arch == "x86_64" {
|
||||||
println!("cargo:rustc-link-lib=UpdateLocksmith_x64");
|
println!("cargo:rustc-link-lib=UpdateLocksmith_x64");
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ pub fn download_url_as_string(url: &str) -> Result<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_download_agent() -> Result<ureq::Agent> {
|
fn get_download_agent() -> Result<ureq::Agent> {
|
||||||
|
#[allow(unused_mut)]
|
||||||
let mut tls_builder = native_tls::TlsConnector::builder();
|
let mut tls_builder = native_tls::TlsConnector::builder();
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
|||||||
@@ -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<()> {
|
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);
|
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))?;
|
let result = handle.wait_timeout(Duration::from_millis(ms_to_wait as u64))?;
|
||||||
if result.is_some() {
|
if result.is_some() {
|
||||||
info!("Parent process exited.");
|
info!("Parent process exited.");
|
||||||
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
bail!("Parent process timed out.");
|
bail!("Parent process timed out.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<()> {
|
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);
|
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))?;
|
let result = handle.wait_timeout(Duration::from_millis(ms_to_wait as u64))?;
|
||||||
if result.is_some() {
|
if result.is_some() {
|
||||||
info!("Parent process exited.");
|
info!("Parent process exited.");
|
||||||
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
bail!("Parent process timed out.");
|
bail!("Parent process timed out.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user