class RSpec::Core::Bisect::ForkRunner::RunDispatcher
@private
def dispatch_specs(run_descriptor)
def dispatch_specs(run_descriptor) pid = fork { run_specs(run_descriptor) } # We don't use Process.waitpid here as it was causing bisects to # block due to the file descriptor limit on OSX / Linux. We need # to detach the process to avoid having zombie processes # consuming slots in the kernel process table during bisect runs. Process.detach(pid) end
def initialize(runner, channel)
def initialize(runner, channel) @runner = runner @channel = channel @spec_output = StringIO.new runner.configuration.tap do |c| c.reset_reporter c.output_stream = @spec_output c.error_stream = @spec_output end end
def run_specs(run_descriptor)
def run_specs(run_descriptor) # :nocov: - Executed in a forked process, by integration/bisect_spec $stdout = $stderr = @spec_output formatter = CaptureFormatter.new(run_descriptor.failed_example_ids) @runner.configuration.tap do |c| c.files_or_directories_to_run = run_descriptor.all_example_ids c.formatter = formatter c.load_spec_files end # `announce_filters` has the side effect of implementing the logic # that honors `config.run_all_when_everything_filtered` so we need # to call it here. When we remove `run_all_when_everything_filtered` # (slated for RSpec 4), we can remove this call to `announce_filters`. @runner.world.announce_filters @runner.run_specs(@runner.world.ordered_example_groups) latest_run_results = formatter.results if latest_run_results.nil? || latest_run_results.all_example_ids.empty? @channel.send(@spec_output.string) else @channel.send(latest_run_results) end # :nocov: end