helper: always reset xmrig GUI output before starting

This commit is contained in:
hinto.janai 2023-03-01 12:04:07 -05:00
parent e23ea89a28
commit 2e90b9803e
No known key found for this signature in database
GPG key ID: D47CE05FA175A499

View file

@ -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);