Don't call fish in the background to generate completions

Fixes #3803 even harder.
This commit is contained in:
Fabian Homborg 2017-02-12 14:03:54 +01:00
parent afdd1a98c1
commit 9598218a94

View file

@ -109,14 +109,24 @@ function __fish_config_interactive -d "Initializations that should be performed
#
# Generate man page completions if not present.
#
# Don't do this if we're being invoked as part of running unit tests.
if not set -q FISH_UNIT_TESTS_RUNNING
if not test -d $userdatadir/fish/generated_completions
# Generating completions from man pages needs python (see issue #3588).
# Don't do this if we're being invoked as part of running unit tests.
# We cannot simply do `fish_update_completions &` because it is a function.
# We cannot do `eval` since it is a function.
# We don't want to call `fish -c` since that is unnecessary and sources config.fish again.
# Hence we'll call python directly.
# c_m_p.py should work with any python version.
set -l update_args -B $__fish_datadir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions'
if command -qs python
and not set -q FISH_UNIT_TESTS_RUNNING
# We cannot simply do `fish_update_completions &` because it is a function. Hence the
# need for the convoluted `eval` to run it in a subshell.
eval (string escape "$__fish_bin_dir/fish") "-c 'fish_update_completions >/dev/null ^/dev/null' &"
python $update_args >/dev/null ^/dev/null &
else if command -qs python2
python2 $update_args >/dev/null ^/dev/null &
else if command -qs python3
python3 $update_args >/dev/null ^/dev/null &
end
end
end