From 05b89244b2c2d2a85ac41b85ddad1216de491963 Mon Sep 17 00:00:00 2001 From: Jordan Hollinger Date: Tue, 10 Nov 2015 16:20:59 -0500 Subject: [PATCH] Always pass a symbol command to execute and test, so that the right SSH user is used --- lib/capistrano/tasks/puma.rake | 4 ++-- lib/capistrano/tasks/workers.rake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/capistrano/tasks/puma.rake b/lib/capistrano/tasks/puma.rake index f3a26c0..151ef24 100644 --- a/lib/capistrano/tasks/puma.rake +++ b/lib/capistrano/tasks/puma.rake @@ -79,7 +79,7 @@ namespace :puma do puma_switch_user(role) do with rack_env: fetch(:puma_env) do if test "[ -f #{fetch(:puma_pid)} ]" - if test "kill -0 $( cat #{fetch(:puma_pid)} )" + if test :kill, "-0 $( cat #{fetch(:puma_pid)} )" execute :pumactl, "-S #{fetch(:puma_state)} -F #{fetch(:puma_conf)} #{command}" else # delete invalid pid file , process is not running. @@ -103,7 +103,7 @@ namespace :puma do within current_path do puma_switch_user(role) do with rack_env: fetch(:puma_env) do - if test "[ -f #{fetch(:puma_pid)} ]" and test "kill -0 $( cat #{fetch(:puma_pid)} )" + if test "[ -f #{fetch(:puma_pid)} ]" and test :kill, "-0 $( cat #{fetch(:puma_pid)} )" # NOTE pid exist but state file is nonsense, so ignore that case execute :pumactl, "-S #{fetch(:puma_state)} -F #{fetch(:puma_conf)} #{command}" else diff --git a/lib/capistrano/tasks/workers.rake b/lib/capistrano/tasks/workers.rake index 9e6aa44..ba0a92b 100644 --- a/lib/capistrano/tasks/workers.rake +++ b/lib/capistrano/tasks/workers.rake @@ -21,7 +21,7 @@ namespace :puma do task :more do on roles (fetch(:puma_role)) do |role| puma_switch_user(role) do - execute("kill -TTIN `cat #{fetch(:puma_pid)}`") + execute(:kill, "-TTIN `cat #{fetch(:puma_pid)}`") end end end @@ -30,7 +30,7 @@ namespace :puma do task :less do on roles (fetch(:puma_role)) do |role| puma_switch_user(role) do - execute("kill -TTOU `cat #{fetch(:puma_pid)}`") + execute(:kill, "-TTOU `cat #{fetch(:puma_pid)}`") end end end