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

delete fifo before killing worker from watchdog

This commit is contained in:
romkatv 2020-01-25 12:18:15 +01:00
parent 2dc56d0afe
commit e97a6c6701
2 changed files with 6 additions and 7 deletions

View file

@ -3,7 +3,7 @@ function _p9k_worker_main() {
mkfifo $_p9k__worker_file_prefix.fifo || return mkfifo $_p9k__worker_file_prefix.fifo || return
echo -nE - s$_p9k_worker_pgid$'\x1e' || return echo -nE - s$_p9k_worker_pgid$'\x1e' || return
exec 0<$_p9k__worker_file_prefix.fifo || return exec 0<$_p9k__worker_file_prefix.fifo || return
rm $_p9k__worker_file_prefix.fifo || return zf_rm $_p9k__worker_file_prefix.fifo || return
typeset -g IFS=$' \t\n\0' typeset -g IFS=$' \t\n\0'
@ -108,6 +108,7 @@ function _p9k_worker_stop() {
[[ -n $_p9k__worker_resp_fd ]] && exec {_p9k__worker_resp_fd}>&- [[ -n $_p9k__worker_resp_fd ]] && exec {_p9k__worker_resp_fd}>&-
[[ -n $_p9k__worker_req_fd ]] && exec {_p9k__worker_req_fd}>&- [[ -n $_p9k__worker_req_fd ]] && exec {_p9k__worker_req_fd}>&-
[[ -n $_p9k__worker_pid ]] && kill -- -$_p9k__worker_pid 2>/dev/null [[ -n $_p9k__worker_pid ]] && kill -- -$_p9k__worker_pid 2>/dev/null
[[ -n $_p9k__worker_file_prefix ]] && zf_rm -f $_p9k__worker_file_prefix.fifo
_p9k__worker_pid= _p9k__worker_pid=
_p9k__worker_req_fd= _p9k__worker_req_fd=
_p9k__worker_resp_fd= _p9k__worker_resp_fd=
@ -205,6 +206,7 @@ function _p9k_worker_start() {
{ {
trap '' PIPE trap '' PIPE
while syswrite $'\x05'; do zselect -t 1000; done while syswrite $'\x05'; do zselect -t 1000; done
zf_rm -f $_p9k__worker_file_prefix.fifo
kill -- -$_p9k_worker_pgid kill -- -$_p9k_worker_pgid
} & } &
exec =true) || return exec =true) || return
@ -230,11 +232,13 @@ emulate -L zsh -o prompt_subst -o interactive_comments # -o xtrace
zmodload zsh/datetime zmodload zsh/datetime
zmodload zsh/system zmodload zsh/system
zmodload -F zsh/files b:zf_mv b:zf_rm
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
function foo_compute() { function foo_compute() {
_p9k_worker_reply 'echo sync latency: $((1000*(EPOCHREALTIME-'$1'))) >>/tmp/log' _p9k_worker_reply 'echo sync latency: $((1000*(EPOCHREALTIME-'$1'))) >>/tmp/log'
_p9k_worker_async foo_async "foo_sync $1" # _p9k_worker_async foo_async "foo_sync $1"
} }
function foo_async() { function foo_async() {

View file

@ -1,5 +1,3 @@
- declare local _p9k_worker_reset in _p9k_worker_receive. it can be set when replies from worker
are eval'd. initial value 0. 1 means reset-prompt is needed. 2 for _p9k_set_prompt + reset-prompt.
- battery: when state or icon change, update with _p9k_set_prompt. make sure icons can be sent with - battery: when state or icon change, update with _p9k_set_prompt. make sure icons can be sent with
`typset -p` in zsh 5.1. `typset -p` in zsh 5.1.
- ram: reduce precision to 2 digits. check if it makes sense for all segments that use the same - ram: reduce precision to 2 digits. check if it makes sense for all segments that use the same
@ -10,6 +8,3 @@
disabling implicit reset on every eval in _p9k_worker_receive. disabling implicit reset on every eval in _p9k_worker_receive.
- implement fake gitstatus api on top of vcs_info (or plain git?) + worker and use it if there is no - implement fake gitstatus api on top of vcs_info (or plain git?) + worker and use it if there is no
gitstatus. gitstatus.
_p9k_worker_async cb1 cb2