Use supports_color in codex exec (#4633)
It knows how to detect github actions
This commit is contained in:
1
codex-rs/Cargo.lock
generated
1
codex-rs/Cargo.lock
generated
@@ -929,6 +929,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"shlex",
|
"shlex",
|
||||||
|
"supports-color",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ owo-colors = { workspace = true }
|
|||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
shlex = { workspace = true }
|
shlex = { workspace = true }
|
||||||
|
supports-color = { workspace = true }
|
||||||
tokio = { workspace = true, features = [
|
tokio = { workspace = true, features = [
|
||||||
"io-std",
|
"io-std",
|
||||||
"macros",
|
"macros",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ use serde_json::Value;
|
|||||||
use std::io::IsTerminal;
|
use std::io::IsTerminal;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use supports_color::Stream;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
@@ -113,8 +114,8 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
|
|||||||
cli::Color::Always => (true, true),
|
cli::Color::Always => (true, true),
|
||||||
cli::Color::Never => (false, false),
|
cli::Color::Never => (false, false),
|
||||||
cli::Color::Auto => (
|
cli::Color::Auto => (
|
||||||
std::io::stdout().is_terminal(),
|
supports_color::on_cached(Stream::Stdout).is_some(),
|
||||||
std::io::stderr().is_terminal(),
|
supports_color::on_cached(Stream::Stderr).is_some(),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user