From 5b6dd661da02be737657719c9da159fde78122b6 Mon Sep 17 00:00:00 2001 From: Nick Herman Date: Thu, 26 Sep 2013 13:09:23 +0300 Subject: [PATCH] Add capistrano restart failback to start. --- lib/puma/capistrano.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/puma/capistrano.rb b/lib/puma/capistrano.rb index 4d38a5ce..8e4cb003 100644 --- a/lib/puma/capistrano.rb +++ b/lib/puma/capistrano.rb @@ -28,7 +28,12 @@ Capistrano::Configuration.instance.load do desc 'Restart puma' task :restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do - run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} restart" + begin + run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} restart" + rescue Capistrano::CommandError => ex + puts "Failed to restart puma: #{ex}\nAssuming not started." + start + end end desc 'Restart puma (phased restart)'