1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-18 03:40:08 +00:00

fix(updater): correctly restart the zsh session when the update pulled changes

This commit is contained in:
Marc Cornellà 2020-11-02 11:17:41 +01:00
parent 889cd7acf3
commit e093a4cf62
2 changed files with 239 additions and 227 deletions

View file

@ -352,9 +352,15 @@ function _omz::theme::use {
function _omz::update {
# 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
}

View file

@ -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() {