$ cat example_spec.rb | ruby -rrspec/autorun - --format json
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/b57d8d09-cb80-486c-a624-162e0568b9ef%40googlegroups.com.
Thanks for letting us know what you figured out, Robb!
def self.run_spec(source_code)
stdin, stdout, stderr = Open3.popen3('ruby -rrspec/autorun - --format json')
stdin.puts source_code
stdin.close
output = stdout.gets
raise "Error running rspec: #{stderr.gets}" if output.nil?
JSON.parse(output)
end
BaseFormatter(#<File:/tmp/887763046.output>)
start(#<struct RSpec::Core::Notifications::StartNotification count=1, load_time=1.0752>), output is #<File:/tmp/887763046.output>
BaseFormatter(#<File:/tmp/3180149450.output>)
start(#<struct RSpec::Core::Notifications::StartNotification count=2, load_time=1.089341>), output is #<File:/tmp/887763046.output (closed)>
rake aborted!
IOError: closed streamAnd that's after I've hacked a few places which do explicitly block changing the output stream after a first run.
def initialize(options, configuration=RSpec.configuration, world=RSpec.world)
@options = options.dup
@configuration = configuration.dup
@world = world.dup
end
Are you interested in this work toward reentrant-safety and thread-safety?