Project

ssh-exec

0.0
No commit activity in last 3 years
No release in over 3 years
A library allowing to execute commands over SSH using Net::SSH
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.1
~> 2.14

Runtime

~> 2.0
 Project Readme

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