From 2e90b9803e2ef8d37cbe9090beb42426f9925ca1 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Wed, 1 Mar 2023 12:04:07 -0500 Subject: [PATCH] helper: always reset `xmrig` GUI output before starting --- src/helper.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/helper.rs b/src/helper.rs index 38724fe..c61bcfd 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -881,13 +881,18 @@ impl Helper { // 2. Input [sudo] pass, wipe, then drop. if cfg!(unix) { debug!("XMRig | Inputting [sudo] and wiping..."); - // 1d. Sleep to wait for [sudo]'s non-echo prompt (on Unix). + // a) Sleep to wait for [sudo]'s non-echo prompt (on Unix). // this prevents users pass from showing up in the STDOUT. sleep!(3000); if let Err(e) = writeln!(pair.master, "{}", lock!(sudo).pass) { error!("XMRig | Sudo STDIN error: {}", e); }; SudoState::wipe(&sudo); + + // b) Reset GUI STDOUT just in case. + debug!("XMRig | Clearing GUI output..."); + lock!(gui_api).output.clear(); } + // 3. Set process state debug!("XMRig | Setting process state..."); let mut lock = lock!(process);