Class: Net::SSH::Connection::LocalSession

Inherits:
Object
  • Object
show all
Includes:
Perform, Upload
Defined in:
lib/ssh/local_session.rb

Instance Method Summary collapse

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

#shellObject



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