I have a strange behavior with net/scp. I'm using ruby 2.3.0, ssh 3.0.2, scp 1.2.1
When a command fails, the error is "stored" and reraised on valid commands.
Here is a sample script:
require "fileutils"
require "net/scp"
# remote_ip= TODO
# remote_user= TODO
connection= Net::SSH.start(remote_ip, remote_user, :keys_only => true)
scp= Net::SCP.new(connection)
# This raises "Errno::ENOENT: No such file or directory - /tmp/no_such_file"
begin
scp.upload!("/tmp/no_such_file", "/tmp/test")
rescue => e
puts "#{e.class}: #{e.message}"
end
FileUtils.touch("/tmp/scp_bug_file")
scp.upload!("/tmp/scp_bug_file", "/tmp/test")
I got the following error:
Errno::ENOENT: No such file or directory @ rb_file_s_stat - /tmp/no_such_file
.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp/upload.rb:117:in `stat': No such file or directory @ rb_file_s_stat - /tmp/no_such_file (Errno::ENOENT)
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp/upload.rb:117:in `set_current'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp/upload.rb:24:in `upload_start_state'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp.rb:369:in `block (3 levels) in start_command'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/channel.rb:324:in `process'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:223:in `block in preprocess'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:223:in `each'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:223:in `preprocess'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:206:in `process'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:170:in `block in loop'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:170:in `loop'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:170:in `loop'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/channel.rb:269:in `wait'
from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp.rb:284:in `upload!'
from ./test.rb:20:in `<main>'
Hello,
I have a strange behavior with net/scp. I'm using ruby 2.3.0, ssh 3.0.2, scp 1.2.1 When a command fails, the error is "stored" and reraised on valid commands.
Here is a sample script:
I got the following error:
see: https://github.com/net-ssh/net-ssh/issues/53