summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-03-22 14:39:59 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-03-22 14:39:59 +0300
commit3fd0e63776aaf5147b9336d822bf41ebc37f9b7d (patch)
treed69766afe4dea368ee14de92e7af2908240a19cd
parent88d81a215f25b82c12662cb52412c81b9d0a4722 (diff)
don't kill timer when subshells exit
-rwxr-xr-xpowerlevel9k.zsh-theme8
1 files changed, 6 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index d35a625b..faa3c156 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -2113,6 +2113,7 @@ typeset -g SED_EXTENDED_REGEX_PARAMETER
typeset -g _P9K_TIMER_FIFO
typeset -gi _P9K_TIMER_FD=0
typeset -gi _P9K_TIMER_PID=0
+typeset -gi _P9K_TIMER_SUBSHELL=0
_p9k_init_timer() {
_p9k_start_timer() {
@@ -2145,11 +2146,14 @@ _p9k_init_timer() {
" </dev/null >&$_P9K_TIMER_FD 2>/dev/null &!
_P9K_TIMER_PID=$!
+ _P9K_TIMER_SUBSHELL=$ZSH_SUBSHELL
function _p9k_kill_timer() {
emulate -L zsh
- (( _P9K_TIMER_PID )) && kill -- -$_P9K_TIMER_PID &>/dev/null
- command rm -f $_P9K_TIMER_FIFO
+ if (( ZSH_SUBSHELL == _P9K_TIMER_SUBSHELL )); then
+ (( _P9K_TIMER_PID )) && kill -- -$_P9K_TIMER_PID &>/dev/null
+ command rm -f $_P9K_TIMER_FIFO
+ fi
}
add-zsh-hook zshexit _p9k_kill_timer
}