Sha256: 15acbf5a47e3bd5b5f933971d4f05aa6259b5b9a3697bbc3b22a27f7db68281b

Contents?: true

Size: 470 Bytes

Versions: 12

Compression:

Stored size: 470 Bytes

Contents

class Net::SSH::Connection::Channel
  PROMPT_REGEXP = Regexp.compile('^' + Regexp.escape(SSHKit::Backend::Netssh::SUDO_PROMPT) + '\b')

  alias on_data_orig on_data

  def on_data(&block)
    on_data_orig do |ch, data|
      sudo_password = Thread.current[SSHKit::Backend::Netssh::SUDO_PASSWORD_KEY]

      if sudo_password and data =~ PROMPT_REGEXP
        ch.send_data(sudo_password + "\n")
      else
        block.call(ch, data) if block
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cronicle-0.2.5 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.2.4 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.2.3 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.2.2 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.2.1 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.2.0 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.1.9 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.1.8 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.1.7 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.1.6 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.1.5 lib/cronicle/ext/net-ssh_ext.rb
cronicle-0.1.4 lib/cronicle/ext/net-ssh_ext.rb