Reputation: 911
#/home/user/a/test.rb
`/home/user/b/test.rb` # not found b's gems
Can not found b's gems when running b/test.rb in a/test.rb(running by user), and running test.rb under /home/user/b directly is OK.
#/home/user/a/test.rb
`sudo -u user /home/user/b/test.rb` # it's OK
And it is OK if running with sudo -u user
.
How to find b's gems and run it except with sudo -u user
Upvotes: 0
Views: 328
Reputation: 79813
I suspect you are looking for Bundler.with_clean_env
:
#/home/user/a/test.rb
Bundler.with_clean_env do
# this assumes b/test.rb sets up Bundler itself
`/home/user/b/test.rb`
end
There is also clean_exec
and clean_system
which wrap system
and exec
, which might be simpler in this case (since you don’t use the result of the backticks):
Bundler.clean_system '/home/user/b/test.rb'
Upvotes: 1
Reputation: 65
You need to run in you terminal:
sudo gem list
and run:
gem list
to see the two list of gems
Upvotes: 0