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
22 23 24 25 26 |
# File 'lib/ssh/local_session.rb', line 22 def exec!(command) out, status = Open3.capture2e(command) raise out unless status.success? out end |
#shell ⇒ Object
41 42 43 |
# File 'lib/ssh/local_session.rb', line 41 def shell self end |
#tell!(command) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/ssh/local_session.rb', line 32 def tell!(command) Open3.popen2e command do |_input, output, wait| output.each do |line| $stdout.print line end raise "command #{command} failed" unless wait.value.success? end end |
#upload_file!(file, destination) ⇒ Object
28 29 30 |
# File 'lib/ssh/local_session.rb', line 28 def upload_file!(file, destination) FileUtils.cp file, destination end |