Skip to content

Commit

Permalink
fix: windows incompatible cmd options for w10 and newer
Browse files Browse the repository at this point in the history
prevent lowering xmrig priority on windows 10&11
  • Loading branch information
Cyrix126 committed Jul 18, 2024
1 parent 0865fe2 commit f1229ef
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/helper/xrig/xmrig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,18 +471,22 @@ impl Helper {
info!("XMRig | Entering watchdog mode... woof!");
// needs xmrig to be in belownormal priority or else Gupaxx will be in trouble if it does not have enough cpu time.
#[cfg(target_os = "windows")]
std::process::Command::new("cmd")
.args(["/c", "/q", "wmic"])
.args([
"process",
"where",
"name='xmrig.exe'",
"CALL",
"setpriority",
"below normal",
])
.spawn()
.expect("failure to execute command wmic");
{
use std::os::windows::process::CommandExt;
std::process::Command::new("cmd")
.creation_flags(0x08000000)
.args(["/c", "wmic"])
.args([
"process",
"where",
"name='xmrig.exe'",
"CALL",
"setpriority",
"below normal",
])
.spawn()
.expect("failure to execute command wmic");
}
loop {
// Set timer
let now = Instant::now();
Expand Down

0 comments on commit f1229ef

Please sign in to comment.