Net::SSH extension for streaming stdout and stderr from remote commnad
Add this line to your application's Gemfile:
gem 'net-ssh-stream'
And then execute:
$ bundle
Or install it yourself as:
$ gem install net-ssh-stream
require 'net/ssh/stream'
stdout = StringIO.new
stderr = StringIO.new
stream = Net::SSH::Stream.new 'host', 'user', password: 'password'
stream.exec 'ls', stdout: stdout, stderr: stderr
stream.close
# OR
Net::SSH::Stream.start('host', 'user', password: 'password') do |stream|
stream.exec 'ls', stdout: stdout, stderr: stderr
end
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/gabynaiman/net-ssh-stream.
The gem is available as open source under the terms of the MIT License.