Sha256: 5b6c0df7feabfb1bcc3503d6281837c4829346e7b2ae247a74c6305676f94607

Contents?: true

Size: 902 Bytes

Versions: 7

Compression:

Stored size: 902 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.success? ? 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

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.3.0.beta8 lib/mutant/killer/forked.rb
mutant-0.3.0.beta7 lib/mutant/killer/forked.rb
mutant-0.3.0.beta6 lib/mutant/killer/forked.rb
mutant-0.3.0.beta5 lib/mutant/killer/forked.rb
mutant-0.3.0.beta4 lib/mutant/killer/forked.rb
mutant-0.3.0.beta3 lib/mutant/killer/forked.rb
mutant-0.3.0.beta2 lib/mutant/killer/forked.rb