From: Alexander Barton Date: Tue, 1 Feb 2022 20:17:03 +0000 (+0100) Subject: Simplify error checking on cache file creation X-Git-Url: https://arthur.ath.cx/gitweb/?a=commitdiff_plain;h=91738cf4ea15ddc93d1de29894b35698948864e0;p=ax-zsh.git Simplify error checking on cache file creation Just try to write to the cache file without testing first. And the "cache_file" variable can never be empty, see code above! --- diff --git a/ax.zsh b/ax.zsh index 8a43349..3d693da 100644 --- a/ax.zsh +++ b/ax.zsh @@ -61,12 +61,10 @@ function axzsh_handle_stage { ) # Create new cache file: - if [[ -n "$cache_file" && -w "$new_cache_file" ]]; then - [[ -n "$AXZSH_DEBUG" ]] \ - && echo " (Writing new cache file to \"$new_cache_file\" ...)" - if ! printf "# %s\n\n" "$(LC_ALL=C date)" >"$new_cache_file"; then - unset new_cache_file - fi + [[ -n "$AXZSH_DEBUG" ]] \ + && echo " (Writing new cache file to \"$new_cache_file\" ...)" + if ! printf "# %s\n\n" "$(LC_ALL=C date)" >"$new_cache_file"; then + unset new_cache_file fi # Read in all the plugins for the current "type":