mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
fix(updater): correctly restart the zsh session when the update pulled changes
This commit is contained in:
parent
889cd7acf3
commit
e093a4cf62
2 changed files with 239 additions and 227 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue