From 82b9392e157ca449685bffe1013a8836c20bbc1e Mon Sep 17 00:00:00 2001 From: Marc Coury Date: Wed, 17 Oct 2018 15:13:58 +0100 Subject: [PATCH 1/3] Made compatible with Mac OSX --- conf.d/__async_prompt.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf.d/__async_prompt.fish b/conf.d/__async_prompt.fish index a96103b..cfbdf0c 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 @@ -139,7 +139,7 @@ and begin if test -n "$pid" echo $pid else - cat /proc/self/stat | awk '{ print $4 }' + echo %self end end end From 05442f66d883bcdfda335f8dd8b9f90296f120f8 Mon Sep 17 00:00:00 2001 From: Marc Coury Date: Wed, 17 Oct 2018 17:26:03 +0100 Subject: [PATCH 2/3] forwards and backwards compatible fish pids --- conf.d/__async_prompt.fish | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/conf.d/__async_prompt.fish b/conf.d/__async_prompt.fish index cfbdf0c..9243f4c 100644 --- a/conf.d/__async_prompt.fish +++ b/conf.d/__async_prompt.fish @@ -139,7 +139,13 @@ and begin if test -n "$pid" echo $pid else - echo %self + if test -n "$fish_pid" + # New fish pid format + echo $fish_pid + else + # Old fish pid format + echo %self + end end end end From a8165427e98f1fb34b5d02057ff68b68c5dcceec Mon Sep 17 00:00:00 2001 From: Marc Coury Date: Wed, 24 Oct 2018 11:12:49 +0100 Subject: [PATCH 3/3] two step evaluation of prompt to reduce time on setting universal variable Unfortunately this doesn't fix the error: ` fish: Locking the universal var file took too long (1.004 seconds).` I think that error is caused by too many threads waiting on the universal file lock: https://github.com/fish-shell/fish-shell/blob/master/src/env_universal_common.cpp#L569 --- conf.d/__async_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.d/__async_prompt.fish b/conf.d/__async_prompt.fish index 9243f4c..214869a 100644 --- a/conf.d/__async_prompt.fish +++ b/conf.d/__async_prompt.fish @@ -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