even further simplify worker bootstrap

pull/445/head
romkatv 5 years ago
parent 23e8921b8d
commit 61df3d1cfb

@ -61,7 +61,7 @@ function _p9k_worker_main() {
done done
done done
} always { } always {
kill -- -$$ kill -- -$sysparams[pid]
} }
} }
@ -260,20 +260,23 @@ function _p9k_worker_start() {
local fifo=$_p9k__worker_file_prefix.fifo local fifo=$_p9k__worker_file_prefix.fifo
local zsh=${${:-/proc/self/exe}:A} local zsh=${${:-/proc/self/exe}:A}
[[ -x $zsh ]] || zsh=zsh [[ -x $zsh ]] || zsh=zsh
local bootstrap=( local bootstrap='
'"emulate" "zsh" "-o" "no_aliases"' "emulate" "-L" "zsh" "-o" "no_aliases" "-o" "no_bgnice"
'{ zmodload zsh/system && mkfifo '${(q)fifo}' && exec >&4 && echo -n "s$sysparams[pid]\x1e" && exec 0<'${(q)fifo}' || exit } always { rm -f '${(q)fifo}' }' {
'IFS= read -rd $'\''\x1e'\'' && eval $REPLY') local fifo='${(q)fifo}'
local child='"eval" "$_p9k_worker_bootstrap" &!' {
local parent=( zmodload zsh/system &&
'"emulate" "-L" "zsh" "-o" "no_aliases" "-o" "no_bgnice"' mkfifo $fifo &&
'echo PARENT $$ >>/tmp/log' exec >&4 &&
'{ eval $_p9k_worker_bootstrap } &!' echo -n "s$sysparams[pid]\x1e" &&
'command true' exec 0<$fifo || exit
) } always { rm -f -- $fifo }
IFS= read -rd $'"'\\x1e'"' && eval $REPLY
} &!
command true'
sysopen -r -o cloexec -u _p9k__worker_resp_fd <( sysopen -r -o cloexec -u _p9k__worker_resp_fd <(
_p9k_worker_bootstrap=${(j:; :)bootstrap} \ _p9k_worker_bootstrap=${bootstrap// ##} </dev/null 4>&1 &>>$log_file \
$zsh -${trace}dfmc ${(j:; :)parent} </dev/null 4>&1 &>>$log_file) || return $zsh -${trace}dfmc '"eval" "$_p9k_worker_bootstrap"' ) || return
zle -F $_p9k__worker_resp_fd _p9k_worker_receive zle -F $_p9k__worker_resp_fd _p9k_worker_receive
_p9k__worker_shell_pid=$sysparams[pid] _p9k__worker_shell_pid=$sysparams[pid]
add-zsh-hook zshexit _p9k_worker_cleanup add-zsh-hook zshexit _p9k_worker_cleanup

Loading…
Cancel
Save