From: Charles O Nutter Date: 2006-03-04T07:05:10+09:00 Subject: Re: Launching Ruby scripts and the future of MVM Just to keep this discussion going, anyone want to take a stab at a sample implementaton of Kernel#ruby based on how Rake does it? Rake defines two methods in its FileUtils class: 'sh' and 'ruby'. 'sh' provides a somewhat neater interface to running a system command with or without a shell, where 'ruby' provides a way to simply execute a Ruby command line using the approprate executable, passing args directly. In all, it's about 40 lines of code, and the 'sh' implementation may be unnecessary for our Kernel purposes. The key bit of logic, though, is how it gets the ruby interpreter to run: RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) If called within Ruby 1.8.x, Kernel#ruby(args, script) would most likely just use the above definition of RUBY and the specified args and/or script (or some other organization of command-line params) to launch an external process. In a multi-VM-aware interpreter, however, it could simply launch a second VM as appropriate, avoiding the second process entirely. -- Charles Oliver Nutter @ headius.blogspot.com JRuby Developer @ jruby.sourceforge.net Application Architect @ www.ventera.com