Skip to content

Commit

Permalink
close writer when done
Browse files Browse the repository at this point in the history
  • Loading branch information
nakkaya committed Aug 18, 2012
1 parent f1c2d23 commit e2ef6a8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/inbox_feed/core.clj
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -246,9 +246,11 @@
(defn atomic-dump [_ obj feed-data] (defn atomic-dump [_ obj feed-data]
(try (try
(let [data-file (File. feed-data) (let [data-file (File. feed-data)
tmp-file (File. (str feed-data ".tmp"))] tmp-file (File. (str feed-data ".tmp"))
(binding [*out* (java.io.FileWriter. tmp-file)] writer (java.io.FileWriter. tmp-file)]
(binding [*out* writer]
(prn obj)) (prn obj))
(.close writer)
(.renameTo tmp-file data-file)) (.renameTo tmp-file data-file))
true true
(catch Exception e (catch Exception e
Expand Down

0 comments on commit e2ef6a8

Please sign in to comment.