开发者

undefined method `send_request' for #<Net::SSH::Connection::Channel:0x0000000163d6d8> (NoMethodError)

Does anybody know what is the correspondi开发者_运维知识库ng command in V2 version of ssh .vs. V1's:

chan.send_request "shell", nil, true

Thanks! Dan


It is send_channel_request.

For example, to test your github connection in Ruby:

Net::SSH.start("github.com", "git", {}) do |session|
  session.open_channel do |channel|

    channel.on_extended_data do |ch, type, data|
      next unless type == 1
      warn data
    end

    channel.send_channel_request "shell"
  end

  session.loop
end

The linked doc also gives an example of handling success/failure (the true argument and on_success/on_failure you passed in v1 are handled differently in v2)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜