module ParallelTests

def self.number_of_running_processes

Fun fact: this includes the current process if it's run via parallel_tests
def self.number_of_running_processes
  if RUBY_ENGINE == "jruby"
    Thread.list.count { |t| t[:running_parallel_test] }
  else
    result = `#{GREP_PROCESSES_COMMAND}`
    raise "Could not grep for processes -> #{result}" if result.strip != "" && !$?.success?
    result.split("\n").size
  end
end