mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Don't call fish in the background to generate completions
Fixes #3803 even harder.
This commit is contained in:
parent
afdd1a98c1
commit
9598218a94
1 changed files with 18 additions and 8 deletions
|
@ -109,14 +109,24 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
#
|
||||
# Generate man page completions if not present.
|
||||
#
|
||||
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.
|
||||
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' &"
|
||||
# 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).
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue