From e9f6de4af6d5c5b4ebf6e3dd5f290bb0d2b87a20 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 7 Sep 2026 20:46:24 +0000 Subject: [PATCH] fix(init): clear partial hostname cache reads Co-authored-by: robbyrussell <257+robbyrussell@users.noreply.github.com> --- oh-my-zsh.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 4e45e9282..8d53befc1 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -104,8 +104,13 @@ if [[ "$OSTYPE" = darwin* ]]; then # (like lib/grep.zsh) and re-check sooner if $HOST changes. __omz_host_cache="$ZSH_CACHE_DIR/localhostname" __omz_host_cached=("$__omz_host_cache"(Nm-1)) + __omz_host_key= + SHORT_HOST= if [[ -n "$__omz_host_cached" ]]; then - { read -r __omz_host_key && read -r SHORT_HOST } < "$__omz_host_cache" + if ! { read -r __omz_host_key && read -r SHORT_HOST } < "$__omz_host_cache"; then + __omz_host_key= + SHORT_HOST= + fi fi if [[ "$__omz_host_key" != "$HOST" || -z "$SHORT_HOST" ]]; then # only cache what scutil actually answered, so a transient failure