Make sure to delete the output file in case of an exception.
authorTilman Sauerbeck <tilman@code-monkey.de>
Wed, 25 May 2005 20:19:45 +0000 (20:19 +0000)
committerTilman Sauerbeck <tilman@code-monkey.de>
Wed, 25 May 2005 20:19:45 +0000 (20:19 +0000)
ChangeLog
lib/redact/app.rb

index 32ff1d1f90dc3f446f89238b8952e99f2f1e2c3c..65a47e6d3572d4c012cd1819c5d25b1d8b71b9c9 100644 (file)
--- 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')
index dc9ef9b52b4d52bb8fb8697e0a0cd1f26c452eeb..2cc9dd7cf74b7022948a0d207380bb08127c32ab 100644 (file)
@@ -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