_filedir, _tilde: Ignore compopt stderr for direct invocations in unit tests.

This commit is contained in:
Ville Skyttä 2012-01-01 14:42:39 +02:00
parent 5882061fec
commit d4416acccc

View File

@ -590,7 +590,8 @@ _filedir()
-n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \ -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
toks+=( $( compgen -f -- $quoted ) ) toks+=( $( compgen -f -- $quoted ) )
[[ ${#toks[@]} -ne 0 ]] && compopt -o filenames # 2>/dev/null for direct invocation, e.g. in the _filedir unit test
[[ ${#toks[@]} -ne 0 ]] && compopt -o filenames 2>/dev/null
COMPREPLY+=( "${toks[@]}" ) COMPREPLY+=( "${toks[@]}" )
} # _filedir() } # _filedir()
@ -923,7 +924,8 @@ _tilde()
# Try generate ~username completions # Try generate ~username completions
COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) ) COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
result=${#COMPREPLY[@]} result=${#COMPREPLY[@]}
[[ $result -gt 0 ]] && compopt -o filenames # 2>/dev/null for direct invocation, e.g. in the _tilde unit test
[[ $result -gt 0 ]] && compopt -o filenames 2>/dev/null
fi fi
return $result return $result
} }