Sha256: ec2a44f86381dc4a272d49343dc55ba102ecad1d7419e47f483d3cacbc4e065a

Contents?: true

Size: 901 Bytes

Versions: 13

Compression:

Stored size: 901 Bytes

Contents

module Mutant
  class Killer

    # Killer that executes other killer in forked environment
    class Forked < self

      # Initialize object
      #
      # @param [Killer] killer
      # @param [Strategy] strategy
      # @param [Mutation] mutation
      #
      # @api private
      #
      def initialize(killer, strategy, mutation)
        @killer = killer
        super(strategy, mutation)
      end

    private

      # Run killer
      #
      # @return [true]
      #   if mutant was killed
      #
      # @return [false]
      #   otherwise
      #
      # @api private
      #
      def run
        pid = fork do
          killer = @killer.new(strategy, mutation)
          exit(killer.killed? ? CLI::EXIT_SUCCESS : CLI::EXIT_FAILURE)
        end

        status = Process.wait2(pid).last
        status.exited? && status.success?
      end

    end # Forked
  end # Killer
end # Mutant

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mutant-0.3.0.beta21 lib/mutant/killer/forked.rb
mutant-0.3.0.beta20 lib/mutant/killer/forked.rb
mutant-0.3.0.beta19 lib/mutant/killer/forked.rb
mutant-0.3.0.beta18 lib/mutant/killer/forked.rb
mutant-0.3.0.beta17 lib/mutant/killer/forked.rb
mutant-0.3.0.beta16 lib/mutant/killer/forked.rb
mutant-0.3.0.beta15 lib/mutant/killer/forked.rb
mutant-0.3.0.beta14 lib/mutant/killer/forked.rb
mutant-0.3.0.beta13 lib/mutant/killer/forked.rb
mutant-0.3.0.beta12 lib/mutant/killer/forked.rb
mutant-0.3.0.beta11 lib/mutant/killer/forked.rb
mutant-0.3.0.beta10 lib/mutant/killer/forked.rb
mutant-0.3.0.beta9 lib/mutant/killer/forked.rb