Commit 5a888ff4 authored by Marc Cornellà's avatar Marc Cornellà
Browse files

fix(updater): don't show changelog when running unattended update (#9495)

Fixes #9495
parent fa1911f8
......@@ -376,13 +376,19 @@ function _omz::theme::use {
function _omz::update {
# Run update script
env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
if [[ "$1" != --unattended ]]; then
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
else
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
fi
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 && "$1" != --unattended ]]; then
# Check whether to run a login shell
......
......@@ -14,7 +14,7 @@ function upgrade_oh_my_zsh() {
fi
# Run update script
env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
local ret=$?
# Update last updated file
zmodload zsh/datetime
......
......@@ -24,7 +24,7 @@ function update_last_updated_file() {
}
function update_ohmyzsh() {
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
update_last_updated_file
}
......
......@@ -70,10 +70,12 @@ if git pull --rebase --stat origin master; then
message="Hooray! Oh My Zsh has been updated!"
# Display changelog with less if available, otherwise just print it to the terminal
if (( $+commands[less] )); then
"$ZSH/tools/changelog.sh" HEAD "$last_commit" --text | command less -R
else
"$ZSH/tools/changelog.sh" HEAD "$last_commit"
if [[ "$1" = --interactive ]]; then
if (( $+commands[less] )); then
"$ZSH/tools/changelog.sh" HEAD "$last_commit" --text | LESS= command less -R
else
"$ZSH/tools/changelog.sh" HEAD "$last_commit"
fi
fi
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment