From a6686ca3100c7df2e472f5a4eecf69d27175b873 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 3 Oct 2020 17:08:13 -0700 Subject: [PATCH] Run makewhatis in the background In the new __fish_apropos, makewhatis is run explicitly to generate the whatis database. However this can be a little slow. Run it in the background, after the apropos call completes so as to avoid a weird race. This means that descriptions may not be available the first time the user invokes it, but that's better than appearing to hang for a while. --- share/functions/__fish_apropos.fish | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/functions/__fish_apropos.fish b/share/functions/__fish_apropos.fish index dd04ed31b..3b1be5c25 100644 --- a/share/functions/__fish_apropos.fish +++ b/share/functions/__fish_apropos.fish @@ -27,12 +27,12 @@ function __fish_apropos set age (math (date +%s) - (stat -f %m $db)) end - if test $age -ge $max_age - echo "making cache $age $max_age" - mkdir -m 700 -p $cache - /usr/libexec/makewhatis -o $db (man --path | string split :) >/dev/null 2>&1 - end MANPATH="$cache" apropos $argv + + if test $age -ge $max_age + mkdir -m 700 -p $cache + /usr/libexec/makewhatis -o $db (man --path | string split :) >/dev/null 2>&1