Skip to content

Commit

Permalink
fix: hide statusfromgupaxx command in p2pool also in lower verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrix126 committed Nov 2, 2024
1 parent 1d58280 commit 35378c3
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/helper/p2pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,35 @@ impl Helper {

// Run a ANSI escape sequence filter for the first few lines.
let mut i = 0;
let mut status_output = false;
while let Some(Ok(line)) = stdout.next() {
let line = strip_ansi_escapes::strip_str(line);

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);
// status could be present before 20 lines with a low verbosity value
if contains_statuscommand(&line) {
status_output = true;
continue;
}
if i > 20 {
break;
if status_output {
if contains_end_status(&line) {
// end of status
status_output = false;
continue;
}
} 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() {
// 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.
Expand Down

0 comments on commit 35378c3

Please sign in to comment.