diff options
author | Christian Höltje <docwhat@gerf.org> | 2018-03-26 21:55:06 +0300 |
---|---|---|
committer | Christian Höltje <docwhat@gerf.org> | 2018-03-26 21:55:06 +0300 |
commit | fe33c401bac783181e0fc53401685fa9b2ad0e24 (patch) | |
tree | 3ea83dc219bbd8f9c522f9359698041ca16933c5 | |
parent | afb7387abec505fb6565d31481c5f5ed724c2f08 (diff) |
workaround for ZSH status behavior
`$pipestatus` is returning all zeros when using `[[ ]]` expressions
that are false.
This works around it by using `$status` (A.K.A. `$?`) when `$pipestatus`
has only 1 items.
Fixes #749
-rwxr-xr-x | powerlevel9k.zsh-theme | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 14d7bd81..2255a04a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1163,8 +1163,13 @@ prompt_status() { local ec if [[ $POWERLEVEL9K_STATUS_SHOW_PIPESTATUS == true ]]; then - ec_text=$(exit_code_or_status "${RETVALS[1]}") - ec_sum=${RETVALS[1]} + if (( $#RETVALS > 1 )); then + ec_text=$(exit_code_or_status "${RETVALS[1]}") + ec_sum=${RETVALS[1]} + else + ec_text=$(exit_code_or_status "${RETVAL}") + ec_sum=${RETVAL} + fi for ec in "${(@)RETVALS[2,-1]}"; do ec_text="${ec_text}|$(exit_code_or_status "$ec")" |