aboutsummaryrefslogtreecommitdiff
path: root/gitstatus/gitstatus.plugin.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2020-02-22 20:48:47 +0300
committerromkatv <roman.perepelitsa@gmail.com>2020-02-22 20:48:47 +0300
commitf1be283dbc97081d2b02abef62599e6e8fd360d9 (patch)
treef9cca13c5d8293a9f343a87e3b0504608427dcc2 /gitstatus/gitstatus.plugin.zsh
parentd53a0440d0b20e267cee94893e028d8ee8f51d7e (diff)
pull upstream changes from gitstatus
Diffstat (limited to 'gitstatus/gitstatus.plugin.zsh')
-rw-r--r--gitstatus/gitstatus.plugin.zsh20
1 files changed, 12 insertions, 8 deletions
diff --git a/gitstatus/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh
index e752ac79..96f8742a 100644
--- a/gitstatus/gitstatus.plugin.zsh
+++ b/gitstatus/gitstatus.plugin.zsh
@@ -459,8 +459,9 @@ function gitstatus_start() {
{
() {
- [[ $sysparams[procsubstpid] == <1-> ]] || return
- typeset -gi GITSTATUS_DAEMON_PID_$name="sysparams[procsubstpid]"
+ if [[ $sysparams[procsubstpid] == <1-> ]]; then
+ typeset -gi GITSTATUS_DAEMON_PID_$name="sysparams[procsubstpid]"
+ fi
sysopen -r -o cloexec -u resp_fd -- $1 || return
typeset -gi _GITSTATUS_RESP_FD_$name=resp_fd
} <(
@@ -502,7 +503,7 @@ function gitstatus_start() {
fi
mkfifo -- $file_prefix.fifo || return
- print -n 1 || return
+ print -rn -- ${(l:20:)pgid} || return
exec <$file_prefix.fifo || return
zf_rm -- $file_prefix.fifo || return
@@ -530,10 +531,13 @@ function gitstatus_start() {
if (( ! async )); then
(( _GITSTATUS_CLIENT_PID_$name == sysparams[pid] )) || return
- local ready
- [[ -t $resp_fd ]]
- sysread -s1 -t $timeout -i $resp_fd ready || return
- [[ $ready == 1 ]] || return
+ local pgid
+ while (( $#pgid < 20 )); do
+ [[ -t $resp_fd ]]
+ sysread -s $((20 - $#pgid)) -t $timeout -i $resp_fd 'pgid[$#pgid+1]' || return
+ done
+ [[ $pgid == ' '#<1-> ]] || return
+ typeset -gi GITSTATUS_DAEMON_PID_$name=pgid
sysopen -w -o cloexec -u req_fd -- $file_prefix.fifo || return
typeset -gi _GITSTATUS_REQ_FD_$name=req_fd
@@ -567,7 +571,7 @@ function gitstatus_start() {
local expected=$'hello\x1f0' actual
while (( $#actual < $#expected )); do
[[ -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
[[ $actual == $expected ]] || return