summaryrefslogtreecommitdiff
path: root/tools/check_for_upgrade.sh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2021-07-11 19:58:51 -0600
committerTuowen Zhao <ztuowen@gmail.com>2021-07-11 19:58:51 -0600
commit617ed3bd9f3d9519fe2354941f3dbf15b0c712ee (patch)
treecaf617b35d3f5f7b5786483eedfcda9361dca108 /tools/check_for_upgrade.sh
parent0144641b7d8e4e6ff6ce153039b5a827f5347904 (diff)
parent36f444ed7325720ec05f182781ec7d6c9a4d675c (diff)
downloadzsh-617ed3bd9f3d9519fe2354941f3dbf15b0c712ee.tar.gz
zsh-617ed3bd9f3d9519fe2354941f3dbf15b0c712ee.tar.bz2
zsh-617ed3bd9f3d9519fe2354941f3dbf15b0c712ee.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'tools/check_for_upgrade.sh')
-rw-r--r--tools/check_for_upgrade.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 29a48b880..e87da3487 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -48,14 +48,17 @@ function update_ohmyzsh() {
return
fi
- # Remove lock directory on exit. `return 1` is important for when trapping a SIGINT:
+ # Remove lock directory on exit. `return $ret` is important for when trapping a SIGINT:
# The return status from the function is handled specially. If it is zero, the signal is
# assumed to have been handled, and execution continues normally. Otherwise, the shell
# will behave as interrupted except that the return status of the trap is retained.
+ # This means that for a CTRL+C, the trap needs to return the same exit status so that
+ # the shell actually exits what it's running.
trap "
- unset -f current_epoch update_last_updated_file update_ohmyzsh
- command rm -rf '$ZSH/log/update.lock'
- return 1
+ ret=\$?
+ unset -f current_epoch update_last_updated_file update_ohmyzsh 2>/dev/null
+ command rm -rf '$ZSH/log/update.lock'
+ return \$ret
" EXIT INT QUIT
# Create or update .zsh-update file if missing or malformed