def run_spec(spec, base_dir, run_opts = "-fs")
$VERBOSE = nil
err, out = StringIO.new, StringIO.new
def out.tty?() true end
options = Spec::Runner::OptionParser.parse(??(
options.filename_pattern = File.expand_path(spec)
failure = ! Spec::Runner::CommandLine.run(options)
File.open(base_dir / "results" / "#{File.basename(spec)}_out", "w") do |file|
file.puts out.string
end
File.open(base_dir / "results" / "#{File.basename(spec)}_err", "w") do |file|
file.puts err.string
end
exit!(failure ? -1 : 0)
end