Class: Mutant::Killer::Forked

Inherits:
Mutant::Killer show all
Defined in:
lib/mutant/killer/forking.rb

Instance Attribute Summary

Attributes inherited from Mutant::Killer

#mutation, #runtime, #strategy

Instance Method Summary collapse

Methods inherited from Mutant::Killer

#fail?, #identification, #mutation_source, #original_source, type

Constructor Details

#initialize(killer, strategy, mutation) ⇒ Forked

Returns a new instance of Forked.



5
6
7
8
# File 'lib/mutant/killer/forking.rb', line 5

def initialize(killer, strategy, mutation)
  @killer = killer
  super(strategy, mutation)
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
# File 'lib/mutant/killer/forking.rb', line 14

def run
  fork do
    killer = @killer.new(strategy, mutation)
    Kernel.exit(killer.fail? ? 1 : 0)
  end

  status = Process.wait2.last
  status.exitstatus.zero?
end

#typeObject



10
11
12
# File 'lib/mutant/killer/forking.rb', line 10

def type
  @killer.type
end