[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

View File

@ -91,11 +91,13 @@ 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
else
output=${output/ */}
if [ "$version" != "$output" ]; then
echo "$output != $version"
binary_error="Invalid version"
else
@ -103,6 +105,7 @@ check_binary() {
binary_error=""
return 0
fi
fi
rm -f "$fzf_base"/bin/fzf
return 1
}