From 9598218a94f6959f8d82687137d5c802aa8d043f Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 12 Feb 2017 14:03:54 +0100 Subject: [PATCH] Don't call fish in the background to generate completions Fixes #3803 even harder. --- .../functions/__fish_config_interactive.fish | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index fe6cbd63b..2716a3a27 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -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