From: Joel VanderWerf Date: 2010-09-09T03:58:45+09:00 Subject: Re: Portable method of launching another Ruby interpreter On 09/08/2010 10:56 AM, Tony Arcieri wrote: > I'm working on a project that requires a "clean", newly launched Ruby > interpreter to perform a little magic. > > I'm looking for a portable way to determine the path to the Ruby interpreter > being used by the current environment. At the very least I'd like for this > to work across Ruby 1.8.7, Ruby 1.9.2, JRuby, and Rubinius. > > I've seen people suggest using Config::CONFIG for this, however from what I > can tell this doesn't work on JRuby. > > Are there any portable solutions to this problem? > Doesn't it work on jruby? $ jruby -v -rrbconfig -e 'p File.join(*Config::CONFIG.values_at("bindir", "ruby_install_name"))' jruby 1.5.0 (ruby 1.8.7 patchlevel 249) (2010-05-12 6769999) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_20) [amd64-java] "/usr/local/jruby/bin/jruby"