From defaa55edb479986cf181176eda89aa53ee0b60e Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Thu, 7 Aug 2014 18:00:41 +0900 Subject: [PATCH] Suppress "No such file or directory - list" message How to reproduce: 1. Remove ~/.fluentd-ui/ 2. Run `bin/rails console` 3. You will see the following output: bin/rails: No such file or directory - list Loading development environment (Rails 4.1.4) irb(main):001:0> --- app/models/plugin.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/plugin.rb b/app/models/plugin.rb index 6db9160..041ba01 100644 --- a/app/models/plugin.rb +++ b/app/models/plugin.rb @@ -88,7 +88,9 @@ class Plugin def self.installed Rails.cache.fetch("installed_gems", expires_in: 3.seconds) do Bundler.with_clean_env do - gems = `#{fluent_gem_path} list`.try(:lines) + fluent_gem = fluent_gem_path + return [] unless fluent_gem + gems = `#{fluent_gem} list`.try(:lines) return [] unless gems gems.grep(/fluent-plugin/).map do |gem| name, versions_str = gem.strip.split(" ")