fix: hide statusfromgupaxx command in p2pool also in lower verbosity

This commit is contained in:
Cyrix126 2024-11-02 18:22:12 +01:00
parent 1d582809da
commit 35378c39ae

View file

@ -49,22 +49,35 @@ impl Helper {
// Run a ANSI escape sequence filter for the first few lines. // Run a ANSI escape sequence filter for the first few lines.
let mut i = 0; let mut i = 0;
let mut status_output = false;
while let Some(Ok(line)) = stdout.next() { while let Some(Ok(line)) = stdout.next() {
let line = strip_ansi_escapes::strip_str(line); let line = strip_ansi_escapes::strip_str(line);
if let Err(e) = writeln!(output_parse.lock().unwrap(), "{}", line) { // status could be present before 20 lines with a low verbosity value
error!("P2Pool PTY Parse | Output error: {}", e); if contains_statuscommand(&line) {
status_output = true;
continue;
} }
if let Err(e) = writeln!(output_pub.lock().unwrap(), "{}", line) { if status_output {
error!("P2Pool PTY Pub | Output error: {}", e); if contains_end_status(&line) {
} // end of status
if i > 20 { status_output = false;
break; continue;
}
} else { } else {
i += 1; if let Err(e) = writeln!(output_parse.lock().unwrap(), "{}", line) {
error!("P2Pool PTY Parse | Output error: {}", e);
}
if let Err(e) = writeln!(output_pub.lock().unwrap(), "{}", line) {
error!("P2Pool PTY Pub | Output error: {}", e);
}
if i > 20 {
break;
} else {
i += 1;
}
} }
} }
let mut status_output = false;
while let Some(Ok(line)) = stdout.next() { while let Some(Ok(line)) = stdout.next() {
// if command status is sent by gupaxx process and not the user, forward it only to update_from_status method. // if command status is sent by gupaxx process and not the user, forward it only to update_from_status method.
// 25 lines after the command are the result of status, with last line finishing by update. // 25 lines after the command are the result of status, with last line finishing by update.