diff --git a/conf.d/__async_prompt.fish b/conf.d/__async_prompt.fish index a96103b..214869a 100644 --- a/conf.d/__async_prompt.fish +++ b/conf.d/__async_prompt.fish @@ -8,7 +8,7 @@ and begin function __async_prompt_setup set -l fish_pids (pgrep -f fish) - set -U -n | sed -rn 's/__async_prompt_.*_([0-9]+)/\0 \1/p' | while read -l varname pid + set -U -n | sed -En 's/__async_prompt_.*_([0-9]+)/\0 \1/p' | while read -l varname pid if not contains "$pid" fish_pids set -e $varname end @@ -65,7 +65,7 @@ and begin set st $status for func in (__async_prompt_config_functions) - __async_prompt_config_inherit_variables | __async_prompt_spawn $st 'set -U __async_prompt_'$func'_text_'(__async_prompt_pid)' ('$func')' + __async_prompt_config_inherit_variables | __async_prompt_spawn $st 'set -l prompt ('$func'); and set -U __async_prompt_'$func'_text_'(__async_prompt_pid)' $prompt' function '__async_prompt_'$func'_handler' --on-process-exit (jobs -lp | tail -n1) kill -WINCH (__async_prompt_pid) sleep 0.1 @@ -139,7 +139,13 @@ and begin if test -n "$pid" echo $pid else - cat /proc/self/stat | awk '{ print $4 }' + if test -n "$fish_pid" + # New fish pid format + echo $fish_pid + else + # Old fish pid format + echo %self + end end end end