Capistrano & Bash: ignore command exit status

前端 未结 7 681
礼貌的吻别
礼貌的吻别 2021-01-31 14:11

I\'m using Capistrano run a remote task. My task looks like this:

task :my_task do
  run \"my_command\"
end

My problem is that if my_comm

7条回答
  •  甜味超标
    2021-01-31 14:46

    I not sure what version they added this code but I like handling this problem by using raise_on_non_zero_exit

    namespace :invoke do
      task :cleanup_workspace do
        on release_roles(:app), in: :parallel do
          execute 'sudo /etc/cron.daily/cleanup_workspace', raise_on_non_zero_exit: false
        end
      end
    end
    

    Here is where that feature is implemented in the gem. https://github.com/capistrano/sshkit/blob/4cfffffde6a643520986ed0f66f21d1357e0cd458b/lib/sshkit/command.rb#L94

提交回复
热议问题