delete fifo before killing worker from watchdog

pull/445/head
romkatv 5 years ago
parent 2dc56d0afe
commit e97a6c6701

@ -3,7 +3,7 @@ function _p9k_worker_main() {
mkfifo $_p9k__worker_file_prefix.fifo || return
echo -nE - s$_p9k_worker_pgid$'\x1e' || 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'
@ -108,6 +108,7 @@ function _p9k_worker_stop() {
[[ -n $_p9k__worker_resp_fd ]] && exec {_p9k__worker_resp_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_file_prefix ]] && zf_rm -f $_p9k__worker_file_prefix.fifo
_p9k__worker_pid=
_p9k__worker_req_fd=
_p9k__worker_resp_fd=
@ -205,6 +206,7 @@ function _p9k_worker_start() {
{
trap '' PIPE
while syswrite $'\x05'; do zselect -t 1000; done
zf_rm -f $_p9k__worker_file_prefix.fifo
kill -- -$_p9k_worker_pgid
} &
exec =true) || return
@ -230,11 +232,13 @@ emulate -L zsh -o prompt_subst -o interactive_comments # -o xtrace
zmodload zsh/datetime
zmodload zsh/system
zmodload -F zsh/files b:zf_mv b:zf_rm
autoload -Uz add-zsh-hook
function foo_compute() {
_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() {

@ -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
`typset -p` in zsh 5.1.
- 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.
- implement fake gitstatus api on top of vcs_info (or plain git?) + worker and use it if there is no
gitstatus.
_p9k_worker_async cb1 cb2

Loading…
Cancel
Save