mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-27 20:25:12 +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.
|
# Generate man page completions if not present.
|
||||||
#
|
#
|
||||||
if not test -d $userdatadir/fish/generated_completions
|
# Don't do this if we're being invoked as part of running unit tests.
|
||||||
# Generating completions from man pages needs python (see issue #3588).
|
if not set -q FISH_UNIT_TESTS_RUNNING
|
||||||
# Don't do this if we're being invoked as part of running unit tests.
|
if not test -d $userdatadir/fish/generated_completions
|
||||||
if command -qs python
|
# Generating completions from man pages needs python (see issue #3588).
|
||||||
and not set -q FISH_UNIT_TESTS_RUNNING
|
|
||||||
# We cannot simply do `fish_update_completions &` because it is a function. Hence the
|
# We cannot simply do `fish_update_completions &` because it is a function.
|
||||||
# need for the convoluted `eval` to run it in a subshell.
|
# We cannot do `eval` since it is a function.
|
||||||
eval (string escape "$__fish_bin_dir/fish") "-c 'fish_update_completions >/dev/null ^/dev/null' &"
|
# 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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue