fix: xmrig can't be started after proxy

This commit is contained in:
Cyrix126 2024-10-09 04:46:25 +02:00
parent 0949458d85
commit 80db6bbacc
2 changed files with 19 additions and 16 deletions

View file

@ -59,22 +59,22 @@ const GUPAX_METADATA: &str = "https://api.github.com/repos/Cyrix126/gupaxx/relea
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(target_family = "unix")] { if #[cfg(target_family = "unix")] {
pub(super) const GUPAX_BINARY: &str = "gupaxx"; pub const GUPAX_BINARY: &str = "gupaxx";
pub(super) const P2POOL_BINARY: &str = "p2pool"; pub const P2POOL_BINARY: &str = "p2pool";
pub(super) const NODE_BINARY: &str = "monerod"; pub const NODE_BINARY: &str = "monerod";
pub(super) const XMRIG_BINARY: &str = "xmrig"; pub const XMRIG_BINARY: &str = "xmrig";
pub(super) const XMRIG_PROXY_BINARY: &str = "xmrig-proxy"; pub const XMRIG_PROXY_BINARY: &str = "xmrig-proxy";
} }
} }
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(target_os = "windows")] { if #[cfg(target_os = "windows")] {
pub(super) const OS_TARGET: &str = "windows"; pub(super) const OS_TARGET: &str = "windows";
pub(super) const ARCHIVE_EXT: &str = "zip"; pub(super) const ARCHIVE_EXT: &str = "zip";
pub(super) const GUPAX_BINARY: &str = "Gupaxx.exe"; pub const GUPAX_BINARY: &str = "Gupaxx.exe";
pub(super) const P2POOL_BINARY: &str = "p2pool.exe"; pub const P2POOL_BINARY: &str = "p2pool.exe";
pub(super) const NODE_BINARY: &str = "monerod.exe"; pub const NODE_BINARY: &str = "monerod.exe";
pub(super) const XMRIG_BINARY: &str = "xmrig.exe"; pub const XMRIG_BINARY: &str = "xmrig.exe";
pub(super) const XMRIG_PROXY_BINARY: &str = "xmrig-proxy.exe"; pub const XMRIG_PROXY_BINARY: &str = "xmrig-proxy.exe";
} else if #[cfg(target_os = "linux")] { } else if #[cfg(target_os = "linux")] {
pub(super) const OS_TARGET: &str = "linux"; pub(super) const OS_TARGET: &str = "linux";
pub(super) const ARCHIVE_EXT: &str = "tar.gz"; pub(super) const ARCHIVE_EXT: &str = "tar.gz";

View file

@ -2,7 +2,10 @@ use std::sync::{Arc, Mutex};
use sysinfo::System; use sysinfo::System;
use crate::helper::ProcessName; use crate::{
components::update::{NODE_BINARY, P2POOL_BINARY, XMRIG_BINARY, XMRIG_PROXY_BINARY},
helper::ProcessName,
};
use super::sudo::SudoState; use super::sudo::SudoState;
@ -98,14 +101,14 @@ impl ErrorState {
pub fn process_running(process_name: ProcessName) -> bool { pub fn process_running(process_name: ProcessName) -> bool {
let name = match process_name { let name = match process_name {
ProcessName::Node => "monerod", ProcessName::Node => NODE_BINARY,
ProcessName::P2pool => "p2pool", ProcessName::P2pool => P2POOL_BINARY,
ProcessName::Xmrig => "xmrig", ProcessName::Xmrig => XMRIG_BINARY,
ProcessName::XmrigProxy => "xmrig-proxy", ProcessName::XmrigProxy => XMRIG_PROXY_BINARY,
ProcessName::Xvb => panic!("XvB does not exist as a process outside of Gupaxx"), ProcessName::Xvb => panic!("XvB does not exist as a process outside of Gupaxx"),
}; };
let s = System::new_all(); let s = System::new_all();
if s.processes_by_name(name.as_ref()).next().is_some() { if s.processes_by_exact_name(name.as_ref()).next().is_some() {
return true; return true;
} }
false false