Sha256: f3fde361e01ad424fd0b3fda357d5ce9285a7b27b2187a294905a19dc6e1af0e

Contents?: true

Size: 920 Bytes

Versions: 26

Compression:

Stored size: 920 Bytes

Contents

# encoding: utf-8

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

26 entries across 26 versions & 1 rubygems

Version Path
mutant-0.5.12 lib/mutant/killer/forked.rb
mutant-0.5.11 lib/mutant/killer/forked.rb
mutant-0.5.10 lib/mutant/killer/forked.rb
mutant-0.5.9 lib/mutant/killer/forked.rb
mutant-0.5.8 lib/mutant/killer/forked.rb
mutant-0.5.7 lib/mutant/killer/forked.rb
mutant-0.5.6 lib/mutant/killer/forked.rb
mutant-0.5.5 lib/mutant/killer/forked.rb
mutant-0.5.4 lib/mutant/killer/forked.rb
mutant-0.5.3 lib/mutant/killer/forked.rb
mutant-0.5.2 lib/mutant/killer/forked.rb
mutant-0.5.1 lib/mutant/killer/forked.rb
mutant-0.5.0 lib/mutant/killer/forked.rb
mutant-0.3.6 lib/mutant/killer/forked.rb
mutant-0.3.5 lib/mutant/killer/forked.rb
mutant-0.3.4 lib/mutant/killer/forked.rb
mutant-0.3.3 lib/mutant/killer/forked.rb
mutant-0.3.2 lib/mutant/killer/forked.rb
mutant-0.3.1 lib/mutant/killer/forked.rb
mutant-0.3.0 lib/mutant/killer/forked.rb