Done in the write_deploy_lock function you may be able to leverage ruby's at_exit handler.
http://trevoke.net/blog/2012/01/06/ruby-what-is-at_exit-and-how-to-write-tests-for-it/ On May 30, 2013, at 2:51 PM, Benjamin Fleischer <[email protected]> wrote: > I also asked on IRC and torrancew led me to try this > > before 'deploy:rollback', 'deploy:unlock' > > def write_deploy_lock(deploy_lock) > put deploy_lock.to_yaml, deploy_lockfile, :mode => 0777 > + # Ensure the lockfile is remove on Interrupt > + trap("INT") { > + STDERR.puts 'Got shutdown signal, removing lockfile' > + remove_deploy_lock > + } > end > > I'm not sure how to test that, but it's what I have for now. I think my other > alternative would be to alias the capistrano handle_errors method to add my > functionality > > If I add a bad github url I get > ERROR: Repository not found. > fatal: The remote end hung up unexpectedly > *** [deploy:update_code] rolling back > Command git ls-remote [email protected]:...git master returned status code pid > 76578 exit 128 > > but it didn't run the unlock task > -- > -- > * You received this message because you are subscribed to the Google Groups > "Capistrano" group. > * To post to this group, send email to [email protected] > * To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/capistrano?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Capistrano" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- * You received this message because you are subscribed to the Google Groups "Capistrano" group. * To post to this group, send email to [email protected] * To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/capistrano?hl=en --- You received this message because you are subscribed to the Google Groups "Capistrano" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
