You will need to fix the Capistrano code if you want it to do different things with exit codes; it is hardcoded to throw an exception if the exit status is non-zero.
Here is the relevant part of lib / capistrano / command.rb. The line starting with if (failed ... is important. Basically, it says that if there are non-zero return values, throw an error.
# Processes the command in parallel on all specified hosts. If the command # fails (non-zero return code) on any of the hosts, this will raise a # Capistrano::CommandError. def process! loop do break unless process_iteration { @channels.any? { |ch| !ch[:closed] } } end logger.trace "command finished" if logger if (failed = @channels.select { |ch| ch[:status] != 0 }).any? commands = failed.inject({}) { |map, ch| (map[ch[:command]] ||= []) << ch[:server]; map } message = commands.map { |command, list| "#{command.inspect} on #{list.join(',')}" }.join("; ") error = CommandError.new("failed: #{message}") error.hosts = commands.values.flatten raise error end self end
Sarah Mei Apr 17 '09 at 4:57 2009-04-17 04:57
source share