(lines: &mut VecDeque<String>, line: &str)
| 421 | } |
| 422 | |
| 423 | fn push_stderr_tail_line(lines: &mut VecDeque<String>, line: &str) { |
| 424 | let bounded_line = truncate_utf8_prefix_by_bytes( |
| 425 | line, |
| 426 | STDERR_TAIL_LINE_MAX_BYTES.min(STDERR_TAIL_MAX_BYTES), |
| 427 | ); |
| 428 | if bounded_line.is_empty() { |
| 429 | return; |
| 430 | } |
| 431 | |
| 432 | while !lines.is_empty() |
| 433 | && (lines.len() >= STDERR_TAIL_LINE_LIMIT |
| 434 | || stderr_tail_bytes_with_candidate(lines, &bounded_line) > STDERR_TAIL_MAX_BYTES) |
| 435 | { |
| 436 | lines.pop_front(); |
| 437 | } |
| 438 | |
| 439 | lines.push_back(bounded_line); |
| 440 | } |
| 441 | |
| 442 | fn stderr_tail_formatted_bytes(lines: &VecDeque<String>) -> usize { |
| 443 | if lines.is_empty() { |
no test coverage detected