M. Yas. Davoodeh <30480116+MYDavoodeh@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date
Message
update: prefix rm call with command in trap (#9107)
* Suppress the problematic trap output in check_upg
The newly added trap, in systems where `rm` is aliased to `rm="rm -v"`,
shows a message stating that "update.lock" has been removed each time `zsh` is called.
I simply suppressed it with directing the output to `/dev/null`.
* Use `command` instead of >/dev/null to suppress
Diff
1diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
2index c91431c25f3a76da7ead6f317909572380a6f107..cadd5fe496a08d9f9edfe1f58170774da326a148 100644
3--- a/tools/check_for_upgrade.sh
4+++ b/tools/check_for_upgrade.sh
5@@ -51,7 +51,7 @@ function update_ohmyzsh() {
6 # The return status from the function is handled specially. If it is zero, the signal is
7 # assumed to have been handled, and execution continues normally. Otherwise, the shell
8 # will behave as interrupted except that the return status of the trap is retained.
9- trap "rm -rf '$ZSH/log/update.lock'; return 1" EXIT INT QUIT
10+ trap "command rm -rf '$ZSH/log/update.lock'; return 1" EXIT INT QUIT
1112 # Create or update .zsh-update file if missing or malformed
13 if ! source "${ZSH_CACHE_DIR}/.zsh-update" 2>/dev/null || [[ -z "$LAST_EPOCH" ]]; then