Get path of currently-executing Ruby interpreter

B

Bill Atkins

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.

--=20
Bill Atkins
 
S

Stefan Lang

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.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,900
Latest member
Nell636132

Latest Threads

Top