Module: RubyForker

Included in:
RspecWorld, TestUnitSpecHelper
Defined in:
lib/vendor/plugins/rspec/spec/ruby_forker.rb

Instance Method Summary collapse

Instance Method Details

#ruby(args, stderr = nil) ⇒ Object

Forks a ruby interpreter with same type as ourself. juby will fork jruby, ruby will fork ruby etc.



6
7
8
9
10
11
12
# File 'lib/vendor/plugins/rspec/spec/ruby_forker.rb', line 6

def ruby(args, stderr=nil)
  config       = ::Config::CONFIG
  interpreter  = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
  cmd = "#{interpreter} #{args}"
  cmd << " 2> #{stderr}" unless stderr.nil?
  `#{cmd}`
end