Skip to content

Commit ca361be

Browse files
committed
feat(__load_completion): don't hush errors or output when sourcing files
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
1 parent 1c69a5a commit ca361be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bash_completion

+3-1
Original file line numberDiff line numberDiff line change
@@ -2287,7 +2287,9 @@ __load_completion()
22872287
for compfile in "$cmd" "$cmd.bash" "_$cmd"; do
22882288
compfile="$dir/$compfile"
22892289
# Avoid trying to source dirs; https://bugzilla.redhat.com/903540
2290-
if [[ -f $compfile ]] && . "$compfile" &>/dev/null; then
2290+
if [[ -d $compfile ]]; then
2291+
echo "bash_completion: $compfile: is a directory" >&2
2292+
elif [[ -e $compfile ]] && . "$compfile"; then
22912293
[[ $backslash ]] && $(complete -p "$cmd") "\\$cmd"
22922294
return 0
22932295
fi

0 commit comments

Comments
 (0)