mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-10 10:19:51 +00:00
fix(bgnotify): make it work with set -e (#12111)
Co-authored-by: ipChrisLee <chrisleecn@outlook.com>
This commit is contained in:
@@ -21,11 +21,11 @@ function bgnotify_end {
|
|||||||
local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
||||||
|
|
||||||
# check time elapsed
|
# check time elapsed
|
||||||
[[ $bgnotify_timestamp -gt 0 ]] || return
|
[[ $bgnotify_timestamp -gt 0 ]] || return 0
|
||||||
[[ $elapsed -ge $bgnotify_threshold ]] || return
|
[[ $elapsed -ge $bgnotify_threshold ]] || return 0
|
||||||
|
|
||||||
# check if Terminal app is not active
|
# check if Terminal app is not active
|
||||||
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return
|
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return 0
|
||||||
|
|
||||||
[[ $bgnotify_bell = true ]] && printf '\a' # beep sound
|
[[ $bgnotify_bell = true ]] && printf '\a' # beep sound
|
||||||
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
|
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
|
||||||
|
|||||||
Reference in New Issue
Block a user