[codex-tui] exit when terminal is dumb (#9293)

Using terminal with TERM=dumb specifically mean that TUIs and the like
don't work. Ensure that codex doesn't run in these environments and exit
with odd errors like crossterm's "Error: The cursor position could not
be read within a normal duration"

---------

Co-authored-by: Josh McKinney <joshka@openai.com>
This commit is contained in:
Jeff Mickey
2026-01-20 16:17:38 -08:00
committed by GitHub
parent 80f80181c2
commit c14e6813fb
3 changed files with 60 additions and 1 deletions

View File

@@ -84,6 +84,17 @@ pub struct AppExitInfo {
pub exit_reason: ExitReason,
}
impl AppExitInfo {
pub fn fatal(message: impl Into<String>) -> Self {
Self {
token_usage: TokenUsage::default(),
thread_id: None,
update_action: None,
exit_reason: ExitReason::Fatal(message.into()),
}
}
}
#[derive(Debug)]
pub(crate) enum AppRunControl {
Continue,