将创建的gem作为sudo运行

我正在研究gem,正在尝试写入/etc/hosts文件,但是普通用户没有权限。通过sudo appname patch_hostfile尝试执行此操作会导致以下结果

.rvm/rubies/ruby-2.6.2/lib/ruby/site_ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': can't find gem appname (>= 0.a) with executable vcdm (Gem::GemNotFoundException)

我认为这样做是因为rake install仅为当前用户安装,但是sudo应该可以访问所有内容,因此我不确定是否是问题所在。

wangjiaxing85 回答:将创建的gem作为sudo运行

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3136953.html

大家都在问