templates/base/config/rubber/deploy-setup.rb in rubber-2.5.3 vs templates/base/config/rubber/deploy-setup.rb in rubber-2.5.4
- old
+ new
@@ -39,16 +39,19 @@
desired_ruby_ver="#{rubber_env.ruby_version}"
if [[ ! $installed_ruby_ver =~ $desired_ruby_ver ]]; then
echo "Compiling and installing ruby $desired_ruby_ver. This may take a while ..."
nohup ruby-build #{rubber_env.ruby_version} #{rubber_env.ruby_path} &> /tmp/install_ruby.log &
+ bg_pid=$!
sleep 1
- while true; do
- if ! ps ax | grep -q "[r]uby-build"; then break; fi
+ while kill -0 $bg_pid &> /dev/null; do
echo -n .
sleep 5
done
+
+ # this returns exit code even if pid has already died, and thus triggers fail fast shell error
+ wait $bg_pid
echo "export RUBYOPT=rubygems\nexport PATH=#{rubber_env.ruby_path}/bin:$PATH" > /etc/profile.d/ruby.sh
echo "--- \ngem: --no-ri --no-rdoc" > /etc/gemrc
fi
ENDSCRIPT