Ruby で予期しない動作が発生していますNet::SFTP
(ruby 1.9.3p194)。
バリアント #1は失敗します。SFTP ブロックを開始しsession.exec!
、シェル コマンドの実行に使用します。
Net::SFTP.start(...) do |sftp|
sftp.session.exec! "mkdir -p ..." # Fails here.
sftp.upload!(...)
end
バリアント #2は成功します。SSH ブロックを開始しsftp.upload!
、ファイルのコピーに使用します。
Net::SSH.start(...) do |ssh|
ssh.exec! "mkdir -p ..."
ssh.sftp.upload!(...)
end
アイデアや説明をいただければ幸いです。
バリアント #1 のスタック トレースは次のとおりです。
can't add a new key into hash during iteration
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:296:in `[]='
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:296:in `open_channel'
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:320:in `exec'
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:354:in `exec!'
dor-services-3.20.0/lib/dor/services/digital_stacks_service.rb:28:in `block in transfer_to_document_store'
net-sftp-2.0.5/lib/net/sftp/session.rb:939:in `call'
net-sftp-2.0.5/lib/net/sftp/session.rb:939:in `block in do_version'
net-sftp-2.0.5/lib/net/sftp/session.rb:939:in `each'
net-sftp-2.0.5/lib/net/sftp/session.rb:939:in `do_version'
net-sftp-2.0.5/lib/net/sftp/session.rb:909:in `when_channel_polled'
net-ssh-2.6.3/lib/net/ssh/connection/channel.rb:311:in `call'
net-ssh-2.6.3/lib/net/ssh/connection/channel.rb:311:in `process'
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:214:in `block in preprocess'
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:214:in `each'
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:214:in `preprocess'
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:197:in `process'
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:161:in `block in loop'
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:161:in `loop'
net-ssh-2.6.3/lib/net/ssh/connection/session.rb:161:in `loop'
net-sftp-2.0.5/lib/net/sftp/session.rb:802:in `loop'
net-sftp-2.0.5/lib/net/sftp/session.rb:787:in `connect!'
net-sftp-2.0.5/lib/net/sftp.rb:32:in `start'