mirror of
https://github.com/openai/codex.git
synced 2026-11-03 19:53:25 +00:00
Harden progress cursor selection
This commit is contained in:
@@ -971,8 +971,8 @@ impl EventProcessorWithHumanOutput {
|
||||
return;
|
||||
}
|
||||
let mut output = String::new();
|
||||
output.push('\r');
|
||||
output.push_str("\u{1b}[2K");
|
||||
output.push_str("\u{1b}[0G");
|
||||
output.push_str(&line);
|
||||
if done {
|
||||
eprintln!("{output}");
|
||||
|
||||
@@ -129,7 +129,16 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
|
||||
match color {
|
||||
cli::Color::Never => false,
|
||||
cli::Color::Always => true,
|
||||
cli::Color::Auto => stderr_with_ansi || std::io::stderr().is_terminal(),
|
||||
cli::Color::Auto => {
|
||||
if stderr_with_ansi || std::io::stderr().is_terminal() {
|
||||
true
|
||||
} else {
|
||||
match std::env::var("TERM") {
|
||||
Ok(term) => !term.is_empty() && term != "dumb",
|
||||
Err(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user