__fish_apropos: Use macOS' stat explicitly

Overrides the GNU tools some people use.

Fixes #7390.
This commit is contained in:
Fabian Homborg 2020-10-09 18:58:35 +02:00
parent cc0e366037
commit fb57ca8791

View file

@ -23,8 +23,11 @@ function __fish_apropos
set -l max_age 86400 # one day
set -l age $max_age
if test -f $db
set age (math (date +%s) - (stat -f %m $db))
if test -f "$db"
# Some people use GNU tools on macOS, and GNU stat works differently.
# However it's currently guaranteed that the macOS stat is in /usr/bin,
# so we use that explicitly.
set age (math (date +%s) - (/usr/bin/stat -f %m $db))
end
MANPATH="$cache" apropos $argv
@ -36,4 +39,4 @@ function __fish_apropos
else
apropos $argv
end
end
end