well, this is what works for me

    def write_deploy_lock(deploy_lock)
      put deploy_lock.to_yaml, deploy_lockfile, :mode => 0777
      # Ensure the lockfile is removed on failure
      at_exit { exit_cleanup('exception on exit') if $! }
      trap('INT') { exit_cleanup('interrupt'); exit 1 }
      on_rollback { exit_cleanup('rollback') }
    end

    def exit_cleanup(reason)
      if @already_removed_lock
        logger.info "[#{reason}] already removed lock"
      else
        logger.important "[#{reason}] Deploy failure, removing lockfile"
        remove_deploy_lock
        @already_removed_lock = true
      end
    end

    def remove_deploy_lock
      run "rm -f #{deploy_lockfile}"
    end

-- 
-- 
* 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.


Reply via email to