Method: InspecPlugins::Parallelism::Runner#run

Defined in:
lib/plugins/inspec-parallel/lib/inspec-parallel/runner.rb

#runObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/runner.rb', line 23

def run
  initiate_background_run if run_in_background # running a process as daemon changes parent process pid
  original_stdout_stream = ChefLicensing::Config.output
  until invocations.empty? && @child_tracker.empty?
    # Changing output to STDERR to avoid the output interruption between runs
    ChefLicensing::Config.output = STDERR
    while should_start_more_jobs?
      if Inspec.locally_windows?
        spawn_another_process
      else
        fork_another_process
      end
    end

    update_ui_poll_select
    cleanup_child_processes
    sleep 0.1
  end
  # Reset output to the original STDOUT stream as a safe measure.
  ChefLicensing::Config.output = original_stdout_stream

  # Requires renaming operations on windows only
  # Do Rename and delete operations after all child processes have exited successfully
  rename_error_log_files if Inspec.locally_windows?
  cleanup_empty_error_log_files
  cleanup_daemon_process if run_in_background
end