Skip to content

Commit

Permalink
Issue #718: Using a subshell to see if compinit -c works. If not then…
Browse files Browse the repository at this point in the history
… reset FPATH for zsh
  • Loading branch information
Robert McLay committed Aug 14, 2024
1 parent 626e78c commit 861b8e2
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions init/bash.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,24 @@ fi

__build_FPATH_for_zsh_ksh()
{
zsh_fpath=$(unset FPATH; zsh -f -c 'echo $FPATH')
export FPATH=$(@PKGV@/libexec/addto --append FPATH ${zsh_fpath} @PKGV@/init/ksh_funcs)
(compinit -c 2> /dev/null)
if [ "$?" != 0 ]; then
zsh_fpath=$(unset FPATH; zsh -f -c 'echo $FPATH')
fi
export FPATH=$(@PKGV@/libexec/addto --append FPATH ${zsh_fpath:-} @PKGV@/init/ksh_funcs)
unset zsh_fpath
}
}

if [ -n "${ZSH_VERSION+x}" -a -z "${__LMOD_SET_ZSH_FPATH+x}" ]; then
export __LMOD_SET_ZSH_FPATH=1
if [ -n "${ZSH_VERSION+x}" ]; then
__build_FPATH_for_zsh_ksh
fi

if [ -n "${KSH_VERSION+x}" -o -n "${BASH_VERSION+x}" ]; then
if [ -z "${__LMOD_SET_KSH_FPATH:-}" ]; then
type zsh > /dev/null 2>&1
if [ "$?" = 0 ]; then
__build_FPATH_for_zsh_ksh
else
export FPATH=$(@PKGV@/libexec/addto --append FPATH ${FPATH:-} @PKGV@/init/ksh_funcs)
fi
export __LMOD_SET_KSH_FPATH=1
type zsh > /dev/null 2>&1
if [ "$?" = 0 ]; then
__build_FPATH_for_zsh_ksh
else
export FPATH=$(@PKGV@/libexec/addto --append FPATH ${FPATH:-} @PKGV@/init/ksh_funcs)
fi
fi

Expand Down

0 comments on commit 861b8e2

Please sign in to comment.