我正在使用Kernel.system
我的 Rails 控制器调用 shell 脚本。shell 脚本可能会根据某些条件调用另一个 Ruby 脚本。此 Ruby 脚本需要 twitter gem。我的 Rails 应用程序正在使用 Passenger 的 apache 中运行。现在,当从我的 Rails 应用程序调用此 Ruby 脚本时,我在 apache 日志中收到以下错误。
/var/www/webapps/test/twitter/twitter_post.rb:2:in `require': no such file to load -- twitter (LoadError)
from /var/www/webapps/test/twitter/twitter_post.rb:2
相同的 Ruby 脚本在 Linux shell 中运行良好。现在,如果我在我的 Gemfile 中列出 twitter gem,它可以完美运行。Kernel.system
应该在子 shell 中调用命令,那么 Rails 是否在其执行 shell 中修改任何环境变量?