def run_features
hook :run_features
Tempfile.open('autotest-cucumber') do |dirty_features_file|
cmd = self.make_cucumber_cmd(self.features_to_run, dirty_features_file.path)
return if cmd.empty?
puts cmd unless $q
old_sync = $stdout.sync
$stdout.sync = true
self.results = []
line = []
begin
open("| #{cmd}", "r") do |f|
until f.eof? do
c = f.getc or break
if RUBY_VERSION >= "1.9" then
print c
else
putc c
end
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.features_to_run = dirty_features_file.read.strip
self.tainted = true unless self.features_to_run == ''
end
hook :ran_features
end