[install] Print better error message when fzf --version failed

Related #1466
This commit is contained in:
Junegunn Choi 2019-03-05 14:44:29 +09:00
parent 3bd8441079
commit 91d04cec5c
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

17
install
View File

@ -91,17 +91,20 @@ ask() {
check_binary() {
echo -n " - Checking fzf executable ... "
local output
output=$("$fzf_base"/bin/fzf --version 2>&1 | awk '{print $1}')
output=$("$fzf_base"/bin/fzf --version 2>&1)
if [ $? -ne 0 ]; then
echo "Error: $output"
binary_error="Invalid binary"
elif [ "$version" != "$output" ]; then
echo "$output != $version"
binary_error="Invalid version"
else
echo "$output"
binary_error=""
return 0
output=${output/ */}
if [ "$version" != "$output" ]; then
echo "$output != $version"
binary_error="Invalid version"
else
echo "$output"
binary_error=""
return 0
fi
fi
rm -f "$fzf_base"/bin/fzf
return 1