mirror of
https://github.com/openai/codex.git
synced 2026-05-05 05:42:33 +03:00
[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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user