diff --git a/share/functions/__fish_cached.fish b/share/functions/__fish_cached.fish index 625b00b05..242ad3cc1 100644 --- a/share/functions/__fish_cached.fish +++ b/share/functions/__fish_cached.fish @@ -23,9 +23,15 @@ function __fish_cached --description "Cache the command output for a given amoun set -l cache_file (path normalize $cache_dir/$cache_key) set -l cache_age (path mtime --relative $cache_file) + set -l populate_cache sh -c " + { + $argv + } >$cache_file || rm $cache_file 2>/dev/null + " + if not test -f $cache_file __fish_cache_put $cache_file - sh -c "{ $argv; } >$cache_file || rm $cache_file 2>/dev/null" & + $populate_cache & if test -n "$last_pid" # wait for at most 1 second if supported @@ -39,7 +45,7 @@ function __fish_cached --description "Cache the command output for a given amoun if test $cache_age -gt $max_age __fish_cache_put $cache_file - sh -c "{ $argv; } >$cache_file || rm $cache_file 2>/dev/null" & + $populate_cache & end end end diff --git a/share/functions/__fish_print_port_packages.fish b/share/functions/__fish_print_port_packages.fish index 0cbae6eef..2515d4b93 100644 --- a/share/functions/__fish_print_port_packages.fish +++ b/share/functions/__fish_print_port_packages.fish @@ -3,7 +3,8 @@ function __fish_print_port_packages type -q -f port || return 1 __fish_cached -t 250 -k port ' - printf "all\ncurrent\nactive\ninactive\ninstalled\nuninstalled\noutdated\n" - port echo all | awk \'{$1=$1};1\'' + printf "all\ncurrent\nactive\ninactive\ninstalled\nuninstalled\noutdated\n" + port echo all | awk \'{$1=$1};1\' + ' return 0 end