Get path of currently-executing Ruby interpreter

Is there a built-in variable that will return the name of the current
Ruby process? I need to start up a separate Ruby process from within
an application, but I can't be sure that ruby will be in PATH. This
has to work on Win32 as well, so shelling out to "whereis" wouldn't
work.

···

--
Bill Atkins

require 'rbconfig'
ruby = File.join(Config::CONFIG["bindir"],
           Config::CONFIG["RUBY_INSTALL_NAME"])

···

On Tuesday 09 August 2005 17:28, Bill Atkins wrote:

Is there a built-in variable that will return the name of the
current Ruby process? I need to start up a separate Ruby process
from within an application, but I can't be sure that ruby will be
in PATH. This has to work on Win32 as well, so shelling out to
"whereis" wouldn't work.

--
Stefan

Stefan Lang said:

require 'rbconfig'
ruby = File.join(Config::CONFIG["bindir"],
           Config::CONFIG["RUBY_INSTALL_NAME"])

I think you will also need EXEEXT:

require 'rbconfig'
ruby = File.join(Config::CONFIG["bindir"],
            Config::CONFIG["RUBY_INSTALL_NAME"]+
            Config::CONFIG["EXEEXT"])

Ryan