aboutsummaryrefslogtreecommitdiff
path: root/gitstatus/gitstatus.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'gitstatus/gitstatus.plugin.zsh')
-rw-r--r--gitstatus/gitstatus.plugin.zsh9
1 files changed, 6 insertions, 3 deletions
diff --git a/gitstatus/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh
index 6e603ae3..d64421db 100644
--- a/gitstatus/gitstatus.plugin.zsh
+++ b/gitstatus/gitstatus.plugin.zsh
@@ -383,6 +383,7 @@ function gitstatus_start() {
$recurse_untracked_dirs)
local cmd="
+ exec >&4
echo \$\$
${(q)daemon} $daemon_args
if [[ \$? != (0|10) && \$? -le 128 && -f ${(q)daemon}-static ]]; then
@@ -395,7 +396,7 @@ function gitstatus_start() {
# We use `zsh -c` instead of plain {} or () to work around bugs in zplug (it hangs on
# startup). Double fork is to daemonize, and so is `setsid`. Note that on macOS `setsid` has
# to be installed manually by running `brew install util-linux`.
- zsh -dfmxc $cmd <$req_fifo >$resp_fifo 2>$log_file 3<$lock_file &!
+ zsh -dfmxc $cmd <$req_fifo >$log_file 2>&1 3<$lock_file 4>$resp_fifo &!
sysopen -w -o cloexec,sync -u req_fd $req_fifo
sysopen -r -o cloexec -u resp_fd $resp_fifo
@@ -405,7 +406,10 @@ function gitstatus_start() {
(( async )) && {
daemon_pid=-1
} || {
- read -u $resp_fd daemon_pid
+ local reply IFS=''
+ read -ru $resp_fd reply
+ [[ $reply == <1-> ]]
+ daemon_pid=reply
function _gitstatus_process_response_${name}() {
local name=${${(%):-%N}#_gitstatus_process_response_}
@@ -418,7 +422,6 @@ function gitstatus_start() {
}
zle -F $resp_fd _gitstatus_process_response_${name}
- local reply IFS=''
read -r -d $'\x1e' -u $resp_fd -t $timeout reply
[[ $reply == $'hello\x1f0' ]]