Class: RemoteTerminal::SSH

Inherits:
Object
  • Object
show all
Defined in:
lib/remote-terminal/ssh.rb

Instance Method Summary collapse

Instance Method Details

#run(server, remote_directory, cmd) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/remote-terminal/ssh.rb', line 3

def run(server, remote_directory, cmd)
  IO.popen("ssh #{server} 'cd #{remote_directory} && #{cmd}'") do |f|
    output = f.gets
    while output
      puts output
      output = f.gets
    end
  end
  return ""
end