This commit is contained in:
Ahmed Ibrahim
2025-08-08 18:15:33 -07:00
parent 14a3bb51b3
commit 697f7b1300
4 changed files with 8 additions and 7 deletions

1
codex-rs/Cargo.lock generated
View File

@@ -667,6 +667,7 @@ dependencies = [
"serde_json",
"tokio",
"toml 0.9.4",
"tracing",
]
[[package]]

View File

@@ -13,6 +13,8 @@ use codex_cli::login::run_login_with_chatgpt;
use codex_cli::login::run_logout;
use codex_cli::proto;
use codex_common::CliConfigOverrides;
use codex_common::updates::check_for_update;
use codex_common::updates::get_upgrade_version;
#[cfg(not(debug_assertions))]
use codex_core::config::Config;
#[cfg(not(debug_assertions))]
@@ -224,10 +226,6 @@ fn print_completion(cmd: CompletionCommand) {
#[cfg(not(debug_assertions))]
async fn run_update() -> anyhow::Result<()> {
use codex_common::updates::check_for_update;
use codex_common::updates::get_upgrade_version;
use std::process::Command;
let overrides = ConfigOverrides {
model: None,
cwd: None,

View File

@@ -16,6 +16,7 @@ serde = { version = "1", features = ["derive"], optional = true }
serde_json = { version = "1", optional = true }
tokio = { version = "1", features = ["fs"], optional = true }
toml = { version = "0.9", optional = true }
tracing = "0.1.41"
[features]
# Separate feature so that `clap` is not a mandatory dependency.

View File

@@ -6,6 +6,7 @@ use serde::Deserialize;
use serde::Serialize;
use std::path::Path;
use std::path::PathBuf;
use tracing::error;
/// Returns the latest available version string if it is newer than the current
/// one, otherwise `None`.
@@ -19,9 +20,9 @@ pub fn get_upgrade_version(config: &Config) -> Option<String> {
} {
// Refresh in the background; callers can use the cached value for this run.
tokio::spawn(async move {
if let Err(e) = check_for_update(&version_file).await {
eprintln!("Failed to update version: {e}");
}
check_for_update(&version_file)
.await
.inspect_err(|e| error!("Failed to update version: {e}"))
});
}