mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
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.
This commit is contained in:
parent
a6a0d43c9c
commit
a6686ca310
1 changed files with 5 additions and 5 deletions
|
@ -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 </dev/null &
|
||||
end
|
||||
else
|
||||
apropos $argv
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue