Fix loop bug during install with blank line in .tool-versions

This commit is contained in:
Akash Manohar J 2016-01-17 08:00:53 +05:30
parent c312b77137
commit d217514081

View File

@ -14,19 +14,14 @@ install_local_tool_versions() {
if [ -f $(pwd)/.tool-versions ]; then if [ -f $(pwd)/.tool-versions ]; then
local asdf_versions_path=$(pwd)/.tool-versions local asdf_versions_path=$(pwd)/.tool-versions
local read_done=false while read tool_line; do
until $read_done; do
read tool_line || read_done=true
if $read_done ; then
break;
fi
IFS=' ' read -a tool_info <<< $tool_line IFS=' ' read -a tool_info <<< $tool_line
local t_name=$(echo "${tool_info[0]}" | xargs) local tool_name=$(echo "${tool_info[0]}" | xargs)
local t_version=$(echo "${tool_info[1]}" | xargs) local tool_version=$(echo "${tool_info[1]}" | xargs)
install_command $t_name $t_version if ! [[ -z "$tool_name" || -z "$tool_version" ]]; then
install_tool_version $tool_name $tool_version
fi
done < $asdf_versions_path done < $asdf_versions_path
else else
echo "Either specify a tool & version in the command" echo "Either specify a tool & version in the command"