diff options
author | Marc Cornellà <marc.cornella@live.com> | 2020-11-02 11:17:41 +0100 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2020-11-30 15:48:46 +0100 |
commit | e093a4cf62d494dc46a8b68de1cb039c0bcf007a (patch) | |
tree | d120b70de530c8abc1067565426ae9e2ad0bae93 /lib/functions.zsh | |
parent | 889cd7acf349f1cae81c07378986157b382f7f1d (diff) | |
download | zsh-e093a4cf62d494dc46a8b68de1cb039c0bcf007a.tar.gz zsh-e093a4cf62d494dc46a8b68de1cb039c0bcf007a.tar.bz2 zsh-e093a4cf62d494dc46a8b68de1cb039c0bcf007a.zip |
fix(updater): correctly restart the zsh session when the update pulled changes
Diffstat (limited to 'lib/functions.zsh')
-rw-r--r-- | lib/functions.zsh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/functions.zsh b/lib/functions.zsh index f6f34e851..b0582b32b 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,11 +15,17 @@ function upgrade_oh_my_zsh() { # Run update script env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" + local ret=$? # Update last updated file zmodload zsh/datetime echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update" # Remove update lock if it exists command rm -rf "$ZSH/log/update.lock" + # Restart the zsh session + if [[ $ret -eq 0 ]]; then + # Check whether to run a login shell + [[ "$ZSH_ARGZERO" = -* ]] && exec -l "${ZSH_ARGZERO#-}" || exec "$ZSH_ARGZERO" + fi } function take() { |