Skip to content
Browse files

[Issue #25] passes test: can slamhound large files without losing any…

… data
  • Loading branch information...
1 parent 1badfae commit 2c0e8a1a1918674403bf02c9367adf9118fdd5ba @AlexBaranosky committed Feb 10, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/slam/hound.clj
View
7 src/slam/hound.clj
@@ -16,8 +16,11 @@
(defn swap-in-reconstructed-ns-form
"Reconstruct file's ns form and rewrite the file on disk with the new form."
[file]
- (let [new-ns (.trim (reconstruct file))
- rdr (PushbackReader. (io/reader file))]
+ (let [tmp-file (doto (File/createTempFile "slamhound_tmp" ".clj")
+ .deleteOnExit)
+ _ (io/copy file tmp-file)
+ new-ns (.trim (reconstruct tmp-file))
+ rdr (PushbackReader. (io/reader tmp-file))]
;; move the reader past the namespace form; discard value
(read rdr)
;; copy in the reconstructed ns form

0 comments on commit 2c0e8a1

Please sign in to comment.
Something went wrong with that request. Please try again.