mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Work around stupid type implementation in the latest sysinfo version.
This commit is contained in:
@@ -8,7 +8,7 @@ use pyo3::{
|
||||
mod blocking;
|
||||
use anyhow::{Error, Result};
|
||||
use blocking::run_query;
|
||||
use sysinfo::{Pid, ProcessExt, System, SystemExt};
|
||||
use sysinfo::{ProcessExt, System, SystemExt};
|
||||
|
||||
const LOCK_FILE: &str = "/run/lqos/libreqos.lock";
|
||||
|
||||
@@ -164,7 +164,8 @@ fn is_libre_already_running() -> PyResult<bool> {
|
||||
if let Ok(contents) = contents {
|
||||
if let Ok(pid) = contents.parse::<i32>() {
|
||||
let sys = System::new_all();
|
||||
if let Some(process) = sys.processes().get(&Pid::from(pid)) {
|
||||
let pid = sysinfo::Pid::from(pid as usize);
|
||||
if let Some(process) = sys.processes().get(&pid) {
|
||||
if process.name().contains("python") {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::{
|
||||
io::{Read, Write},
|
||||
path::Path,
|
||||
};
|
||||
use sysinfo::{Pid, ProcessExt, System, SystemExt};
|
||||
use sysinfo::{ProcessExt, System, SystemExt};
|
||||
|
||||
const LOCK_PATH: &str = "/run/lqos/lqosd.lock";
|
||||
const LOCK_DIR: &str = "/run/lqos";
|
||||
@@ -40,7 +40,8 @@ impl FileLock {
|
||||
let pid: i32 = contents.parse()?;
|
||||
|
||||
let sys = System::new_all();
|
||||
if let Some(process) = sys.processes().get(pid) {
|
||||
let pid = sysinfo::Pid::from(pid as usize);
|
||||
if let Some(process) = sys.processes().get(&pid) {
|
||||
if process.name().contains("lqosd") {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user