diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-11-25 13:14:38 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-11-25 13:14:38 +0300 |
commit | fb89173a4257e0cfe3bfc772bc0cdbccd61e3be0 (patch) | |
tree | d18554885df53f92642c04320cf07a2407a078e8 /gitstatus.plugin.zsh | |
parent | 98b96e06cc98ef2578adbf83ac4bb35a74485e8f (diff) |
Squashed 'gitstatus/' changes from 313fa4f1..1dcba393
1dcba393 bash bindings: provide better diagnostic for the common errors in gitstatus_start
603fb2ce move the rosetta check to `install`
3829edac provide better diagnostic for the common errors in gitstatus_start
e8c9d9cd propagate error messages from install to gitstatus_start; add a special diagnostic for rosetta2
git-subtree-dir: gitstatus
git-subtree-split: 1dcba3930654c54976f112b96acf2ce23006d9e5
Diffstat (limited to 'gitstatus.plugin.zsh')
-rw-r--r-- | gitstatus.plugin.zsh | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/gitstatus.plugin.zsh b/gitstatus.plugin.zsh index 603e04d0..ca0fb311 100644 --- a/gitstatus.plugin.zsh +++ b/gitstatus.plugin.zsh @@ -404,8 +404,8 @@ function _gitstatus_daemon"${1:-}"() { local gitstatus_plugin_dir_var=_gitstatus_plugin_dir$fsuf local gitstatus_plugin_dir=${(P)gitstatus_plugin_dir_var} - builtin set -- -d $gitstatus_plugin_dir -s $uname_s -m $uname_m -p "printf . >&$pipe_fd" -- \ - _gitstatus_set_daemon$fsuf + builtin set -- -d $gitstatus_plugin_dir -s $uname_s -m $uname_m \ + -p "printf '\\001' >&$pipe_fd" -e $pipe_fd -- _gitstatus_set_daemon$fsuf [[ ${GITSTATUS_AUTO_INSTALL:-1} == (|-|+)<1-> ]] || builtin set -- -n "$@" builtin source $gitstatus_plugin_dir/install || return [[ -n $_gitstatus_zsh_daemon ]] || return @@ -542,7 +542,7 @@ function gitstatus_start"${1:-}"() { fi local -i lock_fd resp_fd stderr_fd - local file_prefix xtrace=/dev/null daemon_log=/dev/null + local file_prefix xtrace=/dev/null daemon_log=/dev/null culprit { if (( _GITSTATUS_STATE_$name )); then @@ -637,8 +637,8 @@ function gitstatus_start"${1:-}"() { [[ $req_fd == <1-> ]] || return typeset -gi _GITSTATUS_REQ_FD_$name=req_fd - print -nru $req_fd -- $'hello\x1f\x1e' || return - local expected=$'hello\x1f0\x1e' actual + print -nru $req_fd -- $'}hello\x1f\x1e' || return + local expected=$'}hello\x1f0\x1e' actual if (( $+functions[p10k] )) && [[ ! -t 1 && ! -t 0 ]]; then local -F deadline='EPOCHREALTIME + 4' else @@ -647,8 +647,15 @@ function gitstatus_start"${1:-}"() { while true; do [[ -t $resp_fd ]] sysread -s 1 -t $timeout -i $resp_fd actual || return - [[ $actual == h ]] && break - [[ $actual == . ]] || return + [[ $expected == $actual* ]] && break + if [[ $actual != $'\1' ]]; then + [[ -t $resp_fd ]] + while sysread -t $timeout -i $resp_fd 'actual[$#actual+1]'; do + [[ -t $resp_fd ]] + done + culprit=$actual + return 1 + fi (( EPOCHREALTIME < deadline )) && continue if (( deadline > 0 )); then deadline=0 @@ -747,7 +754,10 @@ function gitstatus_start"${1:-}"() { print -ru2 -- '' print -Pru2 -- '[%F{red}ERROR%f]: gitstatus failed to initialize.' print -ru2 -- '' - print -ru2 -- ' Your Git prompt may disappear or become slow.' + if [[ -n $culprit ]]; then + print -ru2 -- $culprit + return err + fi if [[ -s $xtrace ]]; then print -ru2 -- '' print -Pru2 -- " Zsh log (%U${xtrace//\%/%%}%u):" |