<commit_before>require_relative 'background_process'
require_relative 'process_pool'

# config.include SpawnProcessHelpers
module SpawnProcessHelpers
	def process_pool(options = {})
		@@process_pool ||= CucumberSpawnProcess::ProcessPool.new(options)
	end

	def background_process(path, options = {})
		CucumberSpawnProcess::ProcessPool::ProcessDefinition.new(
			process_pool.pool,
			options[:group] || 'default',
			path,
			options[:load] ? CucumberSpawnProcess::LoadedBackgroundProcess : CucumberSpawnProcess::BackgroundProcess,
			process_pool.options
		)
	end

	def self.report_failed_instance
		@@process_pool.report_failed_instance if @@process_pool
	end
end

# config.add_formatter FailedInstanceReporter
class FailedInstanceReporter
	RSpec::Core::Formatters.register self, :example_failed

	def initialize(output)
		@output = output
	end

	def example_failed(example)
		@output << SpawnProcessHelpers.report_failed_instance
	end
end
<commit_msg>fixed @@process_pool variable existence check<commit_after>require 'rspec'
require 'rspec/core/formatters'
require_relative 'background_process'
require_relative 'process_pool'

# config.include SpawnProcessHelpers
module SpawnProcessHelpers
	def process_pool(options = {})
		@@process_pool ||= CucumberSpawnProcess::ProcessPool.new(options)
	end

	def background_process(path, options = {})
		CucumberSpawnProcess::ProcessPool::ProcessDefinition.new(
			process_pool.pool,
			options[:group] || 'default',
			path,
			options[:load] ? CucumberSpawnProcess::LoadedBackgroundProcess : CucumberSpawnProcess::BackgroundProcess,
			process_pool.options
		)
	end

	def self.report_failed_instance
		@@process_pool.report_failed_instance if defined? @@process_pool
	end
end

# config.add_formatter FailedInstanceReporter
class FailedInstanceReporter
	RSpec::Core::Formatters.register self, :example_failed

	def initialize(output)
		@output = output
	end

	def example_failed(example)
		@output << SpawnProcessHelpers.report_failed_instance
	end
end

{'fraction_non_alphanumeric': 0.08854427213606804, 'fraction_numerical': 0.0, 'mean_word_length': 7.064516129032258, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3831009', 'n_tokens_mistral': 638, 'n_tokens_neox': 606, 'n_words': 111}