From: Tilman Sauerbeck Date: Wed, 25 May 2005 20:19:45 +0000 (+0000) Subject: Make sure to delete the output file in case of an exception. X-Git-Tag: redact-0.1.2~12 X-Git-Url: http://git.code-monkey.de/?p=redact.git;a=commitdiff_plain;h=32110b209dd3a39fc9e36b83ba830a9172ad6c15 Make sure to delete the output file in case of an exception. --- diff --git a/ChangeLog b/ChangeLog index 32ff1d1..65a47e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ -- -$Id: ChangeLog 39 2005-04-28 21:08:11Z tilman $ +$Id: ChangeLog 40 2005-05-25 20:19:45Z tilman $ ++ +2005-05-25 Tilman Sauerbeck (tilman at code-monkey de) + * lib/redact/app.rb: Make sure to delete the output file if + there's an exception while we're writing it + 2005-04-28 Tilman Sauerbeck (tilman at code-monkey de) * lib/redact/app.rb: Don't abort if embryo_cc's return code is 1 (which means 'succeeded, but with warnings') diff --git a/lib/redact/app.rb b/lib/redact/app.rb index dc9ef9b..2cc9dd7 100644 --- a/lib/redact/app.rb +++ b/lib/redact/app.rb @@ -1,5 +1,5 @@ #-- -# $Id: app.rb 39 2005-04-28 21:08:11Z tilman $ +# $Id: app.rb 40 2005-05-25 20:19:45Z tilman $ # # Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de) # @@ -66,15 +66,20 @@ module Redact amx = compile_embryo - Eet::File.open(@options.output, "w") do |ef| - dump_amx(amx, ef) - - dump_header(ef) - dump_collections(ef) - dump_fonts(ef) - dump_images(ef) - dump_source(ef) - dump_fontmap(ef) + begin + Eet::File.open(@options.output, "w") do |ef| + dump_amx(amx, ef) + + dump_header(ef) + dump_collections(ef) + dump_fonts(ef) + dump_images(ef) + dump_source(ef) + dump_fontmap(ef) + end + rescue Exception + File.rm_f(@options.output) + raise end end