Class: Net::SSH::Connection::Session

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

Defined Under Namespace

Classes: Shell

Instance Method Summary collapse

Instance Method Details

#shellObject



24
25
26
# File 'lib/ssh/session.rb', line 24

def shell
  Shell.new self
end

#tell!(command) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ssh/session.rb', line 9

def tell!(command)
  channel = self.open_channel do |ch|
    ch.exec command do |ch, success|
      raise 'could not execute command' unless success
      ch.on_data do |c, data|
        $stdout.print data unless garbage? data
      end
      ch.on_extended_data do |c, type, data|
        $stderr.print data unless garbage? data
      end
    end
  end
  channel.wait
end

#upload_file!(file, destination) ⇒ Object



5
6
7
# File 'lib/ssh/session.rb', line 5

def upload_file!(file, destination)
  scp.upload! file, destination
end