Skip to content

rubytools/ssh-exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ssh-exec

ssh-exec is a wrapper around Net::SSH based on a StackOverflow answer, allowing to easily capture standard output, standard error, and the exit code of a command executed over Net::SSH.

This gem is hosted at http://rubygems.org/gems/ssh-exec.

Examples

require 'net/ssh'
require 'ssh-exec'

Net::SSH.start('somehost', 'someuser') do |ssh|
  result = SshExec.ssh_exec!(ssh, 'echo I am remote host')
  puts result.stdout  # "I am remote host"
  puts result.stderr  # ""
  puts result.exit_status  # 0

  result = SshExec.ssh_exec!(ssh, 'false')
  puts result.exit_status  # 1
end

License

Apache License, Version 2.0

About

A wrapper around Net::SSH allowing to capture remote command output and exit status

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages