lib/capistrano/configuration/actions/invocation.rb
# Returns a Proc object that defines the behavior of the sudo
# callback. The returned Proc will defer to the +fallback+ argument
# (which should also be a Proc) for any output it does not
# explicitly handle.
Returns a Proc object that defines the behavior of the sudo
callback. The returned Proc will defer to the +fallback+ argument
(which should also be a Proc) for any output it does not
explicitly handle.
Returns a Proc object that defines the behavior of the sudo callback . The returned Proc will defer to the + fallback + argument ( which should also be a Proc ) for any output it does not explicitly handle .
def sudo_behavior_callback(fallback) 
          prompt_host = nil
          Proc.new do |ch, stream, out|
            if out =~ /^Sorry, try again/
              if prompt_host.nil? || prompt_host == ch[:server]
                prompt_host = ch[:server]
                logger.important out, "#{stream} :: #{ch[:server]}"
                reset! :password
              end
            end
            if out =~ /^#{Regexp.escape(sudo_prompt)}/
              ch.send_data "#{self[:password]}\n"
            elsif fallback
              fallback.call(ch, stream, out)
            end
          end
        end
def sudo_behavior_callback ( fallback ) prompt_host = nil Proc . new do | ch , stream , out | if out =~ / ^Sorry, try again / if prompt_host . nil? || prompt_host == ch [ :server ] prompt_host = ch [ :server ] logger . important out , "#{stream} :: #{ch[:server]}" reset! :password end end if out =~ / ^ #{ Regexp . escape ( sudo_prompt ) } / ch . send_data "#{self[:password]}\n" elsif fallback fallback . call ( ch , stream , out ) end end end
Returns a Proc object that defines the behavior of the sudo
callback.
Returns a Proc object that defines the behavior of the sudo callback .
#:nodoc: # in order to prevent _each host_ from prompting when the password # was wrong, let's track which host prompted first and only allow # subsequent prompts from that host.
fallback
<not_specific>