lib/autotest/cucumber_mixin.rb in jeffrafter-cucumber-0.1.10 vs lib/autotest/cucumber_mixin.rb in jeffrafter-cucumber-0.1.12
- old
+ new
@@ -68,10 +68,32 @@
hook :run_features
Tempfile.open('autotest-cucumber') do |dirty_scenarios_file|
cmd = self.make_cucumber_cmd self.scenarios_to_run, dirty_scenarios_file.path
return if cmd.empty?
puts cmd unless $q
- system cmd
+ old_sync = $stdout.sync
+ $stdout.sync = true
+ self.results = []
+ line = []
+ begin
+ open("| #{cmd}", "r") do |f|
+ until f.eof? do
+ c = f.getc
+ putc c
+ line << c
+ if c == ?\n then
+ self.results << if RUBY_VERSION >= "1.9" then
+ line.join
+ else
+ line.pack "c*"
+ end
+ line.clear
+ end
+ end
+ end
+ ensure
+ $stdout.sync = old_sync
+ end
self.scenarios_to_run = dirty_scenarios_file.readlines.map { |l| l.chomp }
self.tainted = true unless self.scenarios_to_run == []
end
hook :ran_features
end
\ No newline at end of file