diff --git a/lib/capistrano/tasks/capistrano2.rb b/lib/capistrano/tasks/capistrano2.rb index 6888f07..55861e2 100644 --- a/lib/capistrano/tasks/capistrano2.rb +++ b/lib/capistrano/tasks/capistrano2.rb @@ -59,8 +59,12 @@ def for_each_role end def run_as(cmd) + opts = { + roles: sidekiq_role + } su_user = fetch(:sidekiq_user) - run cmd, roles: sidekiq_role, shell: "su - #{su_user}" + opts[:shell] = "su - #{su_user}" if su_user + run cmd, opts end def quiet_process(pid_file, idx, sidekiq_role)