1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-14 09:00:07 +00:00

further simplify worker bootstrap

This commit is contained in:
romkatv 2020-01-19 13:14:58 +01:00
parent 1208fd10ef
commit 23e8921b8d

View file

@ -261,18 +261,19 @@ function _p9k_worker_start() {
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" "-L" "zsh" "-o" "no_aliases"' '"emulate" "zsh" "-o" "no_aliases"'
'{ mkfifo '${(q)fifo}' && exec >&4 && echo -n "s$$\x1e" && exec 0<'${(q)fifo}' || exit } always { rm -f '${(q)fifo}' }' '{ 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') 'IFS= read -rd $'\''\x1e'\'' && eval $REPLY')
local child='"eval" "$_p9k_worker_bootstrap" &!' local child='"eval" "$_p9k_worker_bootstrap" &!'
local parent=( local parent=(
'"emulate" "-L" "zsh" "-o" "no_aliases" "-o" "no_bgnice"' '"emulate" "-L" "zsh" "-o" "no_aliases" "-o" "no_bgnice"'
${(qqq)zsh}' -'${trace}'dfc '${(qqq)child} 'echo PARENT $$ >>/tmp/log'
'{ eval $_p9k_worker_bootstrap } &!'
'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=${(j:; :)bootstrap} \
</dev/null 4>&1 &>>$log_file $zsh -${trace}dfmc \ $zsh -${trace}dfmc ${(j:; :)parent} </dev/null 4>&1 &>>$log_file) || return
${(j:; :)parent}) || 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