require 'rake' require 'cucumber/rake/task' module Henry class Task # The Henry Task implementation for Cucumber class CucumberTask < Task # Makes available the cucumber rake task. Cucumber::Rake::Task.new do |t| t.cucumber_opts = %w{--out cucumber.out} end # Executes the CucumberTask and returns its results. # # @return [Hash] the CucumberTask results. def execute(params) begin File.open('cucumber.out', 'w') { |f| } #tail_pid = Process.spawn('tail -f cucumber.out') Rake.application['cucumber'].invoke #Process.kill(:SIGINT, tail_pid) { code:0, message:"OK", data:File.open('cucumber.out', 'r').read, stacktrace:nil } rescue Exception => e { code:2, message:e.message, data:File.open('cucumber.out', 'r').read, stacktrace:e.backtrace } end end end end end