You can clone with
I've attached some sample code. I'm trying to get the exit status of commands, and also use the same connection to upload a file. You can see in the example that the command runs fine until I've used .sftp from the ssh connection. Also, if I do this after the sftp call it works:
I'm thinking there's a way to keep both channels open (for the sftp and the command) and still have it work.
Thanks for the great library. Let me know if I can help track this one down.
def run_command(connection, command)
exit_code = nil
connection.open_channel do |channel|
channel.exec(command) do |ch, success|
abort "FAILED: couldn't execute command (connection.channel.exec)"
channel.on_request("exit-status") do |ch,data|
exit_code = data.read_long
puts "Loop on connection"
puts "Finished Loop"
connection = Net::SSH.start('44dates.com', 'ubuntu')
puts "Run ls"
puts "Upload File"
io = StringIO.new("some text")
puts "Run ls Again"
puts "Finished Running ls again"
Thanks for the report. The project is in maintenance mode but I'm happy to pull in a patch.