File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,18 @@ fn handle_app_exit(exit_info: AppExitInfo) -> anyhow::Result<()> {
269269/// Run the update action and print the result.
270270fn run_update_action ( action : UpdateAction ) -> anyhow:: Result < ( ) > {
271271 println ! ( ) ;
272+
273+ // For Homebrew installations, run `brew update` first to sync the cask index.
274+ // Without this, `brew upgrade` may incorrectly report "already latest" when
275+ // a newer version exists but the local cask index is stale.
276+ if action == UpdateAction :: BrewUpgrade {
277+ println ! ( "Syncing Homebrew cask index..." ) ;
278+ let update_status = std:: process:: Command :: new ( "brew" ) . arg ( "update" ) . status ( ) ?;
279+ if !update_status. success ( ) {
280+ anyhow:: bail!( "`brew update` failed with status {update_status}" ) ;
281+ }
282+ }
283+
272284 let ( cmd, args) = action. command_args ( ) ;
273285 let cmd_str = action. command_str ( ) ;
274286 println ! ( "Updating Codex via `{cmd_str}`..." ) ;
You can’t perform that action at this time.
0 commit comments