Use ANSI cursor control for job progress

This commit is contained in:
Dave Aitel
2026-02-06 12:57:17 -05:00
parent b66f7c2357
commit 6225a73c35

View File

@@ -953,19 +953,16 @@ impl EventProcessorWithHumanOutput {
update.failed_items, update.running_items, update.pending_items
);
let done = processed >= update.total_items;
let mut output = String::new();
output.push_str("\u{1b}[2K");
output.push_str("\u{1b}[0G");
output.push_str(&line);
if done {
if self.progress_active {
eprint!("\r");
}
eprintln!("{line}");
eprintln!("{output}");
self.progress_active = false;
self.progress_last_len = 0;
return;
}
let mut output = format!("\r{line}");
if self.progress_last_len > line.len() {
output.push_str(&" ".repeat(self.progress_last_len - line.len()));
}
eprint!("{output}");
let _ = std::io::stderr().flush();
self.progress_active = true;