class RSpecBackgroundProcess::LoadedBackgroundProcess
Private Instance Methods
spawn()
click to toggle source
cmd will be loaded in forked ruby interpreter and arguments passed via ENV This way starting new process will be much faster since ruby VM is already loaded
# File lib/rspec-background-process/background_process.rb, line 393 def spawn puts "loading ruby script: #{@exec}" daemonize('load') do |command| cmd = Shellwords.split(command) file = cmd.shift # reset ARGV Object.instance_eval{ remove_const(:ARGV) } Object.const_set(:ARGV, cmd) # reset $0 $0 = file # reset $* $*.replace(cmd) load file # make sure we exit if loaded file won't exit 0 end end