rhc setup returns “warning: constant ::TimeoutError is deprecated”

烂漫一生 提交于 2019-12-10 16:16:32

问题


Environment

  • Ubuntu 16.04 xenial
  • Linux Kernel: 4.4.0-22-generic
  • ruby --version

ruby 2.3.0p0 (2015-12-25) [x86_64-linux-gnu]

Steps to replicate

sudo apt-get install ruby-full
rhc setup

returns:

/var/lib/gems/2.3.0/gems/commander-4.2.1/lib/commander/user_interaction.rb:328: warning: constant ::TimeoutError is deprecated

After uploading default public key, it shows:

Checking for git ... found git version 2.7.4

Checking common problems ./var/lib/gems/2.3.0/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:67:in initialize': Object#timeout is deprecated, use Timeout.timeout instead. /var/lib/gems/2.3.0/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb:84:in initialize': Object#timeout is deprecated, use Timeout.timeout instead. . done

When running:

rhc --help

It returns:

/var/lib/gems/2.3.0/gems/commander-4.2.1/lib/commander/user_interaction.rb:328: warning: constant ::TimeoutError is deprecated


回答1:


It looks like a gem uses Object#timeout under the hood, which is deprecated. It's recommended to now use Timeout.timeout, like the error says.

As far as what you should do - this is just a deprecation warning, not an error, so probably nothing is broken.

If the warning is really bothering you, you could edit the gem source at /var/lib/gems/2.3.0/gems/net-ssh-2.9.2/lib/net/ssh/transport/session.rb and replace the timeout calls with Timeout.timeout (or fork the gem and make the same changes). The author might appreciate a pull request, if you're eager. But I personally wouldn't worry about this.



来源:https://stackoverflow.com/questions/37626020/rhc-setup-returns-warning-constant-timeouterror-is-deprecated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!