mirror of
https://github.com/openai/codex.git
synced 2026-04-24 22:54:54 +00:00
Use ANSI cursor control for job progress
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user