From: Charles Oliver Nutter Date: 2011-01-15T00:17:55+09:00 Subject: [ruby-core:34501] Re: [Ruby 1.9-Feature#4265][Open] Provide a core method Kernel#ruby for invoking a new Ruby instance On Fri, Jan 14, 2011 at 9:07 AM, Roger Pack wrote: > +1 > > Users do already have this available: > > system("#{Gem.ruby} your_args_here") > > so maybe what we really need is Process.ruby_bin method or something, > so that non gem users can do this also? > > system("#{Process.ruby_bin} your_args_here") > > or perhaps > > RbConfig.ruby_bin > > would be another option in that regard. My hope was that this could be used with JRuby/1.9 MVM support to also hide whether a process were launched at all. The idiom of "re-launch the current Ruby with these arguments" is so common, it would be good to have in core so everyone launches the right instance and implementations that don't need to spin up a new process can do so any way they choose. JRuby currently fakes this by looking for system() command lines that appear to be launching 'ruby' or 'jruby' and simply start a new JRuby instance in the same process, but that often fails (and it would be nice if the user were able to choose how it launches). As Hongli pointed out, and as Gem.ruby shows, it's easy enough to stitch together the right bits to re-launch the current Ruby. It's not so easy to hide the fact that you're physically launching a new process... - Charlie