9004c177bac951f46ab1ec5b74a8bcfb8e3c686b

Author
Gautam krishna R <rgautamkrishna@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(bgnotify): make it work with `set -e` (#12111)

Co-authored-by: ipChrisLee <chrisleecn@outlook.com>

Diff

 1diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh
 2index 3c0766191479e7b8dea9b8a2e257fc2949ff86fc..c28a29e19cf3829ed4a5c94d13887053401233c6 100644
 3--- a/plugins/bgnotify/bgnotify.plugin.zsh
 4+++ b/plugins/bgnotify/bgnotify.plugin.zsh
 5@@ -21,11 +21,11 @@ function bgnotify_end {
 6     local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
 7 
 8     # check time elapsed
 9-    [[ $bgnotify_timestamp -gt 0 ]] || return
10-    [[ $elapsed -ge $bgnotify_threshold ]] || return
11+    [[ $bgnotify_timestamp -gt 0 ]] || return 0
12+    [[ $elapsed -ge $bgnotify_threshold ]] || return 0
13 
14     # check if Terminal app is not active
15-    [[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return
16+    [[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return 0
17 
18     [[ $bgnotify_bell = true ]] && printf '\a' # beep sound
19     bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"