Skip to content

Commit

Permalink
feat(__load_completion): don't hush errors or output when sourcing files
Browse files Browse the repository at this point in the history
We follow the message recent bash would output when sourcing a dir
without letting bash to do it; doing so avoids fd leaks on some older
but still supported bash versions. Other than that, let all output from
sourcing the file pass through to ease debugging.

Closes #506
  • Loading branch information
scop committed Mar 11, 2021
1 parent 1c69a5a commit ca361be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -2287,7 +2287,9 @@ __load_completion()
for compfile in "$cmd" "$cmd.bash" "_$cmd"; do
compfile="$dir/$compfile"
# Avoid trying to source dirs; https://bugzilla.redhat.com/903540
if [[ -f $compfile ]] && . "$compfile" &>/dev/null; then
if [[ -d $compfile ]]; then
echo "bash_completion: $compfile: is a directory" >&2
elif [[ -e $compfile ]] && . "$compfile"; then
[[ $backslash ]] && $(complete -p "$cmd") "\\$cmd"
return 0
fi
Expand Down

0 comments on commit ca361be

Please sign in to comment.