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.
Capistrano is a tool for deploying applications using deployment scripts. To perform deployments, you can use predefined tasks or create custom Rake tasks. RubyMine allows you to quickly run Capistrano tasks with double Ctrl and configure Capistrano run options using run configurations.
Capistrano is a framework for building automated deployment scripts. Although Capistrano itself is written in Ruby, it can easily be used to deploy projects of any language or framework, be it Rails, Java, or PHP.
Navigate to your application's root directory in Terminal and run the following command: capify . This command creates a special file called Capfile in your project, and adds a template deployment recipe at config/deploy.
This book is available for free download in a number of formats - including epub, pdf, azw, mobi and more. You can also read the full text online using our ereader.
The simplest way is to just append true to the end of your command.
task :my_task do run "my_command" end
Becomes
task :my_task do run "my_command; true" end
For Capistrano 3, you can (as suggested here) use the following:
execute "some_command.sh", raise_on_non_zero_exit: false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With