suppress errors from zf_mv (fixes #610)

This commit is contained in:
romkatv 2020-04-05 07:04:58 +02:00
parent b2667b8270
commit 3ef4e68b5f
2 changed files with 22 additions and 11 deletions

View file

@ -1,4 +1,4 @@
if [[ $__p9k_sourced != 8 ]]; then if [[ $__p9k_sourced != 9 ]]; then
>&2 print -P "" >&2 print -P ""
>&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation." >&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation."
>&2 print -P "" >&2 print -P ""
@ -5855,7 +5855,9 @@ _p9k_dump_instant_prompt() {
(( ! $? )) || return (( ! $? )) || return
zf_mv -f $tmp $root_file || return zf_mv -f $tmp $root_file || return
zcompile -R -- $tmp.zwc $root_file || return zcompile -R -- $tmp.zwc $root_file || return
zf_mv -f -- $tmp.zwc $root_file.zwc || return # Error suppression is due to https://github.com/romkatv/powerlevel10k/issues/610.
# I've no idea what actually happens there.
zf_mv -f -- $tmp.zwc $root_file.zwc 2>/dev/null || return
} always { } always {
(( $? )) && zf_rm -f -- $tmp $tmp.zwc 2>/dev/null (( $? )) && zf_rm -f -- $tmp $tmp.zwc 2>/dev/null
} }
@ -5952,7 +5954,9 @@ function _p9k_dump_state() {
} }
zf_mv -f -- $tmp $__p9k_dump_file || return zf_mv -f -- $tmp $__p9k_dump_file || return
zcompile -R -- $tmp.zwc $__p9k_dump_file || return zcompile -R -- $tmp.zwc $__p9k_dump_file || return
zf_mv -f -- $tmp.zwc $__p9k_dump_file.zwc || return # Error suppression is due to https://github.com/romkatv/powerlevel10k/issues/610.
# I've no idea what actually happens there.
zf_mv -f -- $tmp.zwc $__p9k_dump_file.zwc 2>/dev/null || return
} always { } always {
(( $? )) && zf_rm -f -- $tmp $tmp.zwc 2>/dev/null (( $? )) && zf_rm -f -- $tmp $tmp.zwc 2>/dev/null
} }

View file

@ -54,7 +54,7 @@ function _p9k_init_locale() {
if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
_p9k_preinit _p9k_preinit
fi fi
typeset -gr __p9k_sourced=8 typeset -gr __p9k_sourced=9
if [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]; then if [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]; then
if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then
local f local f
@ -63,9 +63,16 @@ function _p9k_init_locale() {
zmodload -F zsh/files b:zf_mv b:zf_rm zmodload -F zsh/files b:zf_mv b:zf_rm
local tmp=$f.tmp.$$.zwc local tmp=$f.tmp.$$.zwc
{ {
zcompile -R -- $tmp $f && zf_mv -f -- $tmp $f.zwc # The first error suppression is a workaround for the bug in
# https://aur.archlinux.org/packages/zsh-theme-powerlevel10k-git/.
# This package misses some source files.
#
# The second error suppression is due to
# https://github.com/romkatv/powerlevel10k/issues/610.
# I've no idea what actually happens there.
zcompile -R -- $tmp $f 2>/dev/null && zf_mv -f -- $tmp $f.zwc 2>/dev/null
} always { } always {
(( $? )) && zf_rm -f -- $tmp (( $? )) && zf_rm -f -- $tmp 2>/dev/null
} }
done done
fi fi