Class: Net::SSH::Connection::Channel
- Inherits:
-
Object
- Object
- Net::SSH::Connection::Channel
- Defined in:
- lib/cronicle/ext/net-ssh_ext.rb
Constant Summary collapse
- PROMPT_REGEXP =
Regexp.compile('^' + Regexp.escape(SSHKit::Backend::Netssh::SUDO_PROMPT) + '\b')
Instance Method Summary collapse
Instance Method Details
#on_data(&block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cronicle/ext/net-ssh_ext.rb', line 6 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 |
#on_data_orig ⇒ Object
4 |
# File 'lib/cronicle/ext/net-ssh_ext.rb', line 4 alias on_data_orig on_data |