# Custom MSpec options
#
class MSpecOptions
  def compiler
    on("--compiler", "Run only the compile part of the compiler specs") do
      SpecDataRelation.enable :compiler
    end
  end

  def gc_stats
    on("--gc-stats", "Show GC stats at the end") do
      config[:gc_stats] = true
    end
  end

  def profiler
    on("--profiler", "Show profiler data at the end") do
      config[:profiler] = true
    end
  end

  def agent
    on("--agent", "Start the Rubinius agent") do
      config[:flags] << "-Xagent.start"
    end
  end
end

# Custom MSpec options
#
class MSpecOptions
  def compiler
    on("--compiler", "Run only the compile part of the compiler specs") do
      SpecDataRelation.enable :compiler
    end
  end

  def gc_stats
    on("--gc-stats", "Show GC stats at the end") do
      config[:gc_stats] = true
    end
  end

  def profiler
    on("--profiler", "Show profiler data at the end") do
      config[:profiler] = true
    end
  end

  def agent
    on("--agent", "Start the Rubinius agent") do
      config[:launch] << "-Xagent.start"
    end
  end
end

Use mspec :launch instead of :flags so Agent doesn't start in sub-specs.
Use mspec :launch instead of :flags so Agent doesn't start in sub-specs.

There are specs that unconditionally kill the exe and that does
not allow the exe to perform any cleanup. This results in numerous
garbage rbx Agent connection files. It would be nice to have the
Agent running in all spec processes in case one hangs, but since
rbx doesn't get a chance to do cleanup when :KILL'd, there's no
good way to prevent littering these files. So Agent is only started
for the main process running the specs.
