Capistrano & Bash: ignore command exit status

2019-03-08 22:58发布

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_command has an exit status != 0, then Capistrano considers it failed and exits. How can I make capistrano keep going when exit when the exit status is not 0? I've changed my_command to my_command;echo and it works but it feels like a hack.

7条回答
狗以群分
2楼-- · 2019-03-09 00:02

For Capistrano 3, you can (as suggested here) use the following:

execute "some_command.sh", raise_on_non_zero_exit: false
查看更多
登录 后发表回答