higher sysinfo version
This commit is contained in:
parent
38c9e142ff
commit
09b823d637
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -5746,9 +5746,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sysinfo"
|
name = "sysinfo"
|
||||||
version = "0.26.9"
|
version = "0.28.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c18a6156d1f27a9592ee18c1a846ca8dd5c258b7179fc193ae87c74ebb666f5"
|
checksum = "d3e847e2de7a137c8c2cede5095872dbb00f4f9bf34d061347e36b43322acd56"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"core-foundation-sys 0.8.3",
|
"core-foundation-sys 0.8.3",
|
||||||
|
@ -34,7 +34,7 @@ tokio-socks = { git = "https://github.com/open-trade/tokio-socks" }
|
|||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
backtrace = "0.3"
|
backtrace = "0.3"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
sysinfo = "0.26"
|
sysinfo = "0.28"
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
mac_address = "1.1"
|
mac_address = "1.1"
|
||||||
|
@ -547,13 +547,13 @@ async fn check_pid(postfix: &str) {
|
|||||||
if let Ok(mut file) = File::open(&pid_file) {
|
if let Ok(mut file) = File::open(&pid_file) {
|
||||||
let mut content = String::new();
|
let mut content = String::new();
|
||||||
file.read_to_string(&mut content).ok();
|
file.read_to_string(&mut content).ok();
|
||||||
let pid = content.parse::<i32>().unwrap_or(0);
|
let pid = content.parse::<usize>().unwrap_or(0);
|
||||||
if pid > 0 {
|
if pid > 0 {
|
||||||
use hbb_common::sysinfo::{ProcessExt, System, SystemExt};
|
use hbb_common::sysinfo::{ProcessExt, System, SystemExt};
|
||||||
let mut sys = System::new();
|
let mut sys = System::new();
|
||||||
sys.refresh_processes();
|
sys.refresh_processes();
|
||||||
if let Some(p) = sys.process(pid.into()) {
|
if let Some(p) = sys.process(pid.into()) {
|
||||||
if let Some(current) = sys.process((std::process::id() as i32).into()) {
|
if let Some(current) = sys.process((std::process::id() as usize).into()) {
|
||||||
if current.name() == p.name() {
|
if current.name() == p.name() {
|
||||||
// double check with connect
|
// double check with connect
|
||||||
if connect(1000, postfix).await.is_ok() {
|
if connect(1000, postfix).await.is_ok() {
|
||||||
|
@ -581,7 +581,7 @@ fn check_main_window() -> bool {
|
|||||||
sys.refresh_processes();
|
sys.refresh_processes();
|
||||||
let app = format!("/Applications/{}.app", crate::get_app_name());
|
let app = format!("/Applications/{}.app", crate::get_app_name());
|
||||||
let my_uid = sys
|
let my_uid = sys
|
||||||
.process((std::process::id() as i32).into())
|
.process((std::process::id() as usize).into())
|
||||||
.map(|x| x.user_id())
|
.map(|x| x.user_id())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
for (_, p) in sys.processes().iter() {
|
for (_, p) in sys.processes().iter() {
|
||||||
@ -667,9 +667,6 @@ pub fn change_resolution(name: &str, width: usize, height: usize) -> ResultType<
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn check_super_user_permission() -> ResultType<bool> {
|
pub fn check_super_user_permission() -> ResultType<bool> {
|
||||||
unsafe {
|
unsafe { Ok(MacCheckAdminAuthorization() == YES) }
|
||||||
Ok(MacCheckAdminAuthorization() == YES)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user