1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-22 12:20:07 +00:00

pull upstream changes from gitstatus

This commit is contained in:
romkatv 2020-02-22 18:48:47 +01:00
parent d53a0440d0
commit f1be283dbc

View file

@ -459,8 +459,9 @@ function gitstatus_start() {
{ {
() { () {
[[ $sysparams[procsubstpid] == <1-> ]] || return if [[ $sysparams[procsubstpid] == <1-> ]]; then
typeset -gi GITSTATUS_DAEMON_PID_$name="sysparams[procsubstpid]" typeset -gi GITSTATUS_DAEMON_PID_$name="sysparams[procsubstpid]"
fi
sysopen -r -o cloexec -u resp_fd -- $1 || return sysopen -r -o cloexec -u resp_fd -- $1 || return
typeset -gi _GITSTATUS_RESP_FD_$name=resp_fd typeset -gi _GITSTATUS_RESP_FD_$name=resp_fd
} <( } <(
@ -502,7 +503,7 @@ function gitstatus_start() {
fi fi
mkfifo -- $file_prefix.fifo || return mkfifo -- $file_prefix.fifo || return
print -n 1 || return print -rn -- ${(l:20:)pgid} || return
exec <$file_prefix.fifo || return exec <$file_prefix.fifo || return
zf_rm -- $file_prefix.fifo || return zf_rm -- $file_prefix.fifo || return
@ -530,10 +531,13 @@ function gitstatus_start() {
if (( ! async )); then if (( ! async )); then
(( _GITSTATUS_CLIENT_PID_$name == sysparams[pid] )) || return (( _GITSTATUS_CLIENT_PID_$name == sysparams[pid] )) || return
local ready local pgid
while (( $#pgid < 20 )); do
[[ -t $resp_fd ]] [[ -t $resp_fd ]]
sysread -s1 -t $timeout -i $resp_fd ready || return sysread -s $((20 - $#pgid)) -t $timeout -i $resp_fd 'pgid[$#pgid+1]' || return
[[ $ready == 1 ]] || return done
[[ $pgid == ' '#<1-> ]] || return
typeset -gi GITSTATUS_DAEMON_PID_$name=pgid
sysopen -w -o cloexec -u req_fd -- $file_prefix.fifo || return sysopen -w -o cloexec -u req_fd -- $file_prefix.fifo || return
typeset -gi _GITSTATUS_REQ_FD_$name=req_fd typeset -gi _GITSTATUS_REQ_FD_$name=req_fd
@ -567,7 +571,7 @@ function gitstatus_start() {
local expected=$'hello\x1f0' actual local expected=$'hello\x1f0' actual
while (( $#actual < $#expected )); do while (( $#actual < $#expected )); do
[[ -t $resp_fd ]] [[ -t $resp_fd ]]
sysread -s $(($#expected - $#actual)) -t $timeout -i $resp_fd actual || return sysread -s $(($#expected - $#actual)) -t $timeout -i $resp_fd 'actual[$#actual+1]' || return
done done
[[ $actual == $expected ]] || return [[ $actual == $expected ]] || return