MCPcopy Create free account
hub / github.com/Noumena-Network/code / push_stderr_tail_line

Function push_stderr_tail_line

rust/py_repl_host/src/main.rs:423–440  ·  view source on GitHub ↗
(lines: &mut VecDeque<String>, line: &str)

Source from the content-addressed store, hash-verified

421}
422
423fn 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
442fn stderr_tail_formatted_bytes(lines: &VecDeque<String>) -> usize {
443 if lines.is_empty() {

Callers 1

spawn_kernelFunction · 0.85

Tested by

no test coverage detected