From 7e0e85bdda092d94aef0374af720682c6ea8999d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Sun, 19 Oct 2014 18:06:09 +0200 Subject: [PATCH] Avoid JRuby warning during rehash Rubygems plugin As it seems, JRuby 1.7 complains on stderr every time you invoke `system`: warning: executable? does not in this environment and will return a dummy value It doesn't seem to complain when backtics are used. It's safe to use backticks here because `rbenv rehash` doesn't output anything on stdout, and the exit status of the command is irrelevant. --- rbenv.d/exec/gem-rehash/rubygems_plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rbenv.d/exec/gem-rehash/rubygems_plugin.rb b/rbenv.d/exec/gem-rehash/rubygems_plugin.rb index e1d7b262..21d5ad9a 100644 --- a/rbenv.d/exec/gem-rehash/rubygems_plugin.rb +++ b/rbenv.d/exec/gem-rehash/rubygems_plugin.rb @@ -3,7 +3,7 @@ hook = lambda do |installer| # Ignore gems that aren't installed in locations that rbenv searches for binstubs if installer.spec.executables.any? && [Gem.default_bindir, Gem.bindir(Gem.user_dir)].include?(installer.bin_dir) - system "rbenv", "rehash" + `rbenv rehash` end rescue warn "rbenv: error in gem-rehash (#{$!})"