t413 / zsh-background-notify

cross-platform background notifications for long running commands!
93 stars 14 forks source link

zsh precmd isn't firing #19

Closed Cypher1 closed 4 years ago

Cypher1 commented 7 years ago

Hi, I'm having a bit of an odd issue with zsh (using oh-my-zsh's copy of bgnotify) and I was wondering if you could help me. It seems that my zsh is not issues precmd hooks (which means that bgnotify doesn't work for me). Testing:

function start() { echo "START" }
function end() { echo "END" }

add-zsh-hook preexec start
add-zsh-hook precmd end
>> START

sleep 5 &
>> START
[1] <pid>
[1]  + <pid> done sleep 5

Is there anything I can check to see if the hooks are broken or disabled? Thanks

ea2809 commented 4 years ago

Dear @Cypher1, this is my fix, same problem... But 3 years later...

Change the last lines of the script and test:

    preexec_functions+=(bgnotify_begin)
    precmd_functions+=(bgnotify_end)
Cypher1 commented 4 years ago

Thanks @ea2809, after 3 years I'd forgotten this bug. Turns out something has changed in zsh itself and I can no longer re-pro the problem. Thanks for your fix though, it looks like both now work.