Skip to content

Commit

Permalink
Merge pull request #4 from mec07/master
Browse files Browse the repository at this point in the history
Made compatible with Mac OSX
  • Loading branch information
acomagu authored Apr 7, 2019
2 parents f2dc2b8 + a816542 commit 9ff5367
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions conf.d/__async_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 9ff5367

Please sign in to comment.