Browse files

Print a more useful error message if the user used 'sudo' instead of …

  • Loading branch information...
FooBarWidget committed Oct 4, 2013
1 parent 53ba6f1 commit c62462cae1e31eca988ca3c7ac6da19a8b669332
Showing with 8 additions and 3 deletions.
  1. +1 −0 NEWS
  2. +7 −3 lib/phusion_passenger/platform_info/ruby.rb
@@ -5,6 +5,7 @@ Release 4.0.20
mode, the Nginx temporary directory was deleted prematurely, causing some
POST requests to fail. This was a regression that was introduced in 4.0.15
as part of an optimization.
+ * Improved detection of RVM problems.
* [Enterprise] Fixed a packaging problem which caused the flying-passenger
executable not to be properly included in the bin path.
* [Enterprise] Fixed a race condition which sometimes causes the Flying
@@ -255,19 +255,23 @@ def self.rvm_ruby_string
matching_path = $LOAD_PATH.find_all do |item|
- if matching_path
+ if matching_path && !matching_path.empty?
subpath = matching_path.to_s.gsub(/^.*rvm\/gems\//, '')
result = subpath.split('/').first
return result if result
# On Ruby 1.9, $LOAD_PATH does not contain any gem paths until
# at least one gem has been required so the above can fail.
# We're out of options now, we can't detect the gem set.
# Raise an exception so that the user knows what's going on
# instead of having things fail in obscure ways later.
STDERR.puts "Unable to autodetect the currently active RVM gem " +
- "set name. Please contact this program's author for support."
+ "set name. This could happen if you ran this program using 'sudo' " +
+ "instead of 'rvmsudo'. When using RVM, you're always supposed to " +
+ "use 'rvmsudo' instead of 'sudo!'.\n\n" +
+ "Please try rerunning this program using 'rvmsudo'. If that " +
+ "doesn't help, please contact this program's author for support."
exit 1
return nil

0 comments on commit c62462c

Please sign in to comment.