|
|
@ -347,22 +347,31 @@ function gitstatus_start() {
|
|
|
|
--dirty-max-index-size=${(q)dirty_max_index_size}
|
|
|
|
--dirty-max-index-size=${(q)dirty_max_index_size}
|
|
|
|
${${log_level:#INFO}:+--log-level=$log_level})
|
|
|
|
${${log_level:#INFO}:+--log-level=$log_level})
|
|
|
|
|
|
|
|
|
|
|
|
# We use `zsh -c` instead of plain {} or () to work around bugs in zplug. It hangs on startup.
|
|
|
|
local cmd="
|
|
|
|
zsh -dfxc "
|
|
|
|
echo \$\$
|
|
|
|
${(q)daemon} $daemon_args
|
|
|
|
${(q)daemon} $daemon_args
|
|
|
|
if [[ \$? != (0|10) && \$? -le 128 &&
|
|
|
|
if [[ \$? != (0|10) && \$? -le 128 &&
|
|
|
|
-z ${(q)GITSTATUS_DAEMON:-} &&
|
|
|
|
-z ${(q)GITSTATUS_DAEMON:-} &&
|
|
|
|
-f ${(q)daemon}-static ]]; then
|
|
|
|
-f ${(q)daemon}-static ]]; then
|
|
|
|
${(q)daemon}-static $daemon_args
|
|
|
|
${(q)daemon}-static $daemon_args
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo -nE $'bye\x1f0\x1e'
|
|
|
|
echo -nE $'bye\x1f0\x1e'"
|
|
|
|
" <$req_fifo >$resp_fifo 2>$log_file 3<$lock_file &!
|
|
|
|
local setsid=${commands[setsid]:-/usr/local/opt/util-linux/bin/setsid}
|
|
|
|
|
|
|
|
[[ -f $setsid ]] && setsid=${(q)setsid} || setsid=
|
|
|
|
daemon_pid=$!
|
|
|
|
cmd="$setsid zsh -dfxc ${(q)cmd} &!"
|
|
|
|
|
|
|
|
# We use `zsh -c` instead of plain {} or () to work around bugs in zplug. It hangs on startup.
|
|
|
|
|
|
|
|
# Double fork is to daemonize. Some macOS users had issues when gitstatusd was a child process
|
|
|
|
|
|
|
|
# of the interactive zsh. For example, https://github.com/romkatv/powerlevel10k/issues/123
|
|
|
|
|
|
|
|
# and https://github.com/romkatv/powerlevel10k/issues/97. If you are using macOS and seeing
|
|
|
|
|
|
|
|
# errors like `gitstatus_query:echo:32: write error: broken pipe`, install `setsid` utility
|
|
|
|
|
|
|
|
# by running `brew install util-linux`.
|
|
|
|
|
|
|
|
zsh -dfmxc $cmd <$req_fifo >$resp_fifo 2>$log_file 3<$lock_file &!
|
|
|
|
|
|
|
|
|
|
|
|
sysopen -w -o cloexec,sync -u req_fd $req_fifo
|
|
|
|
sysopen -w -o cloexec,sync -u req_fd $req_fifo
|
|
|
|
sysopen -r -o cloexec -u resp_fd $resp_fifo
|
|
|
|
sysopen -r -o cloexec -u resp_fd $resp_fifo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
read -u $resp_fd daemon_pid
|
|
|
|
|
|
|
|
|
|
|
|
rm -f $req_fifo $resp_fifo $lock_file
|
|
|
|
rm -f $req_fifo $resp_fifo $lock_file
|
|
|
|
|
|
|
|
|
|
|
|
function _gitstatus_process_response_${name}() {
|
|
|
|
function _gitstatus_process_response_${name}() {
|
|
|
|