From 011bdf9110e6b6330f2cadea41b53da833328640 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Sun, 28 Dec 2014 16:14:55 +0200 Subject: [PATCH] safe bash based remote_process_exists --- lib/capistrano/unicorn/utility.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/capistrano/unicorn/utility.rb b/lib/capistrano/unicorn/utility.rb index 3870ac8..d31f8ef 100644 --- a/lib/capistrano/unicorn/utility.rb +++ b/lib/capistrano/unicorn/utility.rb @@ -40,11 +40,7 @@ def working_directory(path); end # Check if a remote process exists using its pid file # def remote_process_exists?(pid_file) - begin - execute(*try_unicorn_user, 'kill', '-0', get_unicorn_pid) if within(fetch(:app_path)) { test('[', '-e', pid_file, ']') } - rescue SSHKit::Command::Failed => e - false - end + test("[ -e #{pid_file} ]") && test("ps -p `cat #{pid_file}` > /dev/null") end # Stale Unicorn process pid file