From f7e220bb1806035a3e5a86f39af04cf4fe6f4c85 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 17 Oct 2011 11:10:00 -0400 Subject: [PATCH] fix output file writing --- lib/jasmine/headless/runner.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/jasmine/headless/runner.rb b/lib/jasmine/headless/runner.rb index ecb04ef..e2667d1 100644 --- a/lib/jasmine/headless/runner.rb +++ b/lib/jasmine/headless/runner.rb @@ -67,18 +67,16 @@ module Jasmine :only => @options[:files] ) - targets = template_writer.write!(files_list) - run_targets = targets.dup + @_targets = template_writer.write!(files_list) + run_targets = @_targets.dup run_targets.pop if (!@options[:full_run] && files_list.filtered?) || files_list.has_spec_outside_scope? system jasmine_command(run_targets) - status = $?.exitstatus - - if !(runner_filename || (@options[:remove_html_file] && status != 0)) - targets.each { |target| FileUtils.rm_f target } + @_status = $?.exitstatus + ensure + if @_targets && !runner_filename && (@options[:remove_html_file] || (@_status == 0)) + @_targets.each { |target| FileUtils.rm_f target } end - - status end def runner_filename