in focus/util/src/sandbox_command.rs [302:327]
fn work(description: String, file: File, cancel_rx: mpsc::Receiver<()>) {
let buffered_reader = BufReader::new(file);
let mut lines = buffered_reader.lines();
let span = info_span!("Output", command=?description);
let _guard = span.enter();
while cancel_rx.try_recv().is_err() {
while let Some(Ok(line)) = lines.next() {
// A carriage return at the end of the line is often used for
// interactive applications to update the line of output which
// is already present in the terminal. We can't do that here
// because we immediately overwrite the just-printed line with
// information about the parameters in `info!`. Instead,
// simulate clearing the line which removing anything that
// appears before a `\r` and strip the last one.
let line = line
.trim_end_matches('\r')
.split('\r')
.last()
.unwrap_or_default();
info!("{}", line);
}
std::thread::sleep(Duration::from_millis(50));
}
}