0

I would like to upload multiple files to a remote machine in parallel. This is what I have tried so far based on the documentation

Net::SCP.start(ip, user) do |scp|
  channels = []
  dst = 'some_remote_location'

  stl_files.each do |f|
    channels << scp.upload(f, dst)
  end
  channels.each{|channel| channel.wait}
end

but I receive the following error

Error: #<Net::SSH::ChannelOpenFailed: open failed (1)>

I have also tried an alternative approach

Net::SSH.start(ip, user) do |ssh|
  channels = []
  dst = 'some_remote_location'

  stl_files.each do |f|
    channels << ssh.scp.upload(f, dst)
  end
  channels.each{|channel| channel.wait}
  ssh.loop
end

but the error is the same.

The blocking version scp.upload! or ssh.scp.upload! works as expected.

Rojj
  • 1,170
  • 1
  • 12
  • 32

0 Answers0