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} t.fork = false 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) { name: self.name, code: 'OK', message: 'OK', returnedData: { output: File.open('cucumber.out', 'r').read } } rescue Exception => e { name: self.name, code: 'ERROR', message: 'ERROR', returnedData: { output: File.open('cucumber.out', 'r').read, backtrace: e.message } } end end end end end