module SimpleCov::CLI::Run

def rubyopt_env

def rubyopt_env
  existing = ENV["RUBYOPT"].to_s.strip
  injection = "-r#{AUTOSTART}"
  merged = existing.empty? ? injection : "#{existing} #{injection}"
  ENV.to_hash.merge("RUBYOPT" => merged)
end

def run(args, stderr:, **)

def run(args, stderr:, **)
  cmd = args.first == "--" ? args.drop(1) : args
  if cmd.empty?
    stderr.puts("simplecov run: missing command")
    return 1
  end
  Kernel.exec(rubyopt_env, *cmd)
rescue Errno::ENOENT => e
  stderr.puts("simplecov run: #{e.message}")
  127
end