1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-16 17:50:09 +00:00

pull upstream changes from gitstatus

This commit is contained in:
romkatv 2019-03-20 12:09:16 +01:00
parent df6ba3a560
commit abfa07667a
5 changed files with 5 additions and 8 deletions

View file

@ -226,28 +226,25 @@ function gitstatus_start() {
" <&$req_fd >&$resp_fd 2>$log_file 3<$lock_file &! " <&$req_fd >&$resp_fd 2>$log_file 3<$lock_file &!
daemon_pid=$! daemon_pid=$!
command rm -f $lock_file
local reply local reply
echo -nE $'hello\x1f\x1e' >&$req_fd echo -nE $'hello\x1f\x1e' >&$req_fd
IFS='' read -r -d $'\x1e' -u $resp_fd -t $timeout reply IFS='' read -r -d $'\x1e' -u $resp_fd -t $timeout reply
[[ $reply == $'hello\x1f0' ]] [[ $reply == $'hello\x1f0' ]]
function _gitstatus_cleanup_${name}() { function _gitstatus_cleanup_${daemon_pid}() {
emulate -L zsh emulate -L zsh
setopt err_return no_unset setopt err_return no_unset
local name=${${(%)${:-%N}}#_gitstatus_cleanup_} local -i daemon_pid=${${(%)${:-%N}}#_gitstatus_cleanup_}
local -i daemon_pid=${(P)${:-GITSTATUS_DAEMON_PID_$name}} kill -- -$daemon_pid &>/dev/null || true
[[ $daemon_pid -gt 0 ]] && kill -- -$daemon_pid &>/dev/null || true
local lock_file=${(P)${:-_GITSTATUS_LOCK_FILE_$name}}
command rm -f $lock_file || true
} }
add-zsh-hook zshexit _gitstatus_cleanup_${name} add-zsh-hook zshexit _gitstatus_cleanup_${daemon_pid}
} }
start && { start && {
typeset -g GITSTATUS_DAEMON_LOG_${name}=$log_file typeset -g GITSTATUS_DAEMON_LOG_${name}=$log_file
typeset -gi GITSTATUS_DAEMON_PID_${name}=$daemon_pid typeset -gi GITSTATUS_DAEMON_PID_${name}=$daemon_pid
typeset -g _GITSTATUS_LOCK_FILE_${name}=$lock_file
typeset -giH _GITSTATUS_REQ_FD_${name}=$req_fd typeset -giH _GITSTATUS_REQ_FD_${name}=$req_fd
typeset -giH _GITSTATUS_RESP_FD_${name}=$resp_fd typeset -giH _GITSTATUS_RESP_FD_${name}=$resp_fd
typeset -giH _GITSTATUS_CLIENT_PID_${name}=$$ typeset -giH _GITSTATUS_CLIENT_PID_${name}=$$