From e093a4cf62d494dc46a8b68de1cb039c0bcf007a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 2 Nov 2020 11:17:41 +0100 Subject: fix(updater): correctly restart the zsh session when the update pulled changes --- lib/functions.zsh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/functions.zsh') 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() { -- cgit v1.2.3-70-g09d2