Class: Net::SSH::Connection::LocalSession
- Inherits:
-
Object
- Object
- Net::SSH::Connection::LocalSession
- Includes:
- Perform, Upload
- Defined in:
- lib/ssh/local_session.rb
Instance Method Summary collapse
- #exec!(command) ⇒ Object
- #shell ⇒ Object
- #tell!(command) ⇒ Object
- #upload_file!(file, destination) ⇒ Object
Instance Method Details
#exec!(command) ⇒ Object
8 9 10 |
# File 'lib/ssh/local_session.rb', line 8 def exec!(command) Open3.capture2e(command).first rescue 'command not found' end |
#shell ⇒ Object
24 25 26 |
# File 'lib/ssh/local_session.rb', line 24 def shell self end |
#tell!(command) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/ssh/local_session.rb', line 16 def tell!(command) Open3.popen2e command do |_input, output| output.each do |line| $stdout.print line end end end |
#upload_file!(file, destination) ⇒ Object
12 13 14 |
# File 'lib/ssh/local_session.rb', line 12 def upload_file!(file, destination) FileUtils.cp file, destination end |