Skip to content

Commit 97ec263

Browse files
committed
Update to Java commit fba9b9a (2013.08.14): CLJ-1154 - Compile.main() should not close the output stream as this prevents reporting in subsequent calls (usually in tooling).
1 parent 961ce87 commit 97ec263

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

Clojure/Clojure.Compile/Compile.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ static void Main(string[] args)
8989
Var.popThreadBindings();
9090
try {
9191
outTW.Flush();
92-
outTW.Close();
9392
}
9493
catch ( IOException e)
9594
{

Clojure/Clojure.Tests/clojure/test_clojure/compilation.clj

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,31 @@
171171
(should-not-reflect #(loop [k 5.0] (recur (clojure.test-clojure.compilation/primfn 0))))
172172

173173
(should-print-err-message #"(?s).*k is not matching primitive.*"
174-
#(loop [k (clojure.test-clojure.compilation/primfn)] (recur :foo))))
174+
#(loop [k (clojure.test-clojure.compilation/primfn)] (recur :foo))))
175+
176+
;;;(deftest CLJ-1154-use-out-after-compile
177+
;;; ;; This test creates a dummy file to compile, sets up a dummy
178+
;;; ;; compiled output directory, and a dummy output stream, and
179+
;;; ;; verifies the stream is still usable after compiling.
180+
;;; (spit "test/dummy.clj" "(ns dummy)")
181+
;;; (try
182+
;;; (let [compile-path (System/getProperty "clojure.compile.path")
183+
;;; tmp (java.io.File. "tmp")
184+
;;; new-out (java.io.OutputStreamWriter. (java.io.ByteArrayOutputStream.))]
185+
;;; (binding [clojure.core/*out* new-out]
186+
;;; (try
187+
;;; (.mkdir tmp)
188+
;;; (System/setProperty "clojure.compile.path" "tmp")
189+
;;; (clojure.lang.Compile/main (into-array ["dummy"]))
190+
;;; (println "this should still work without throwing an exception" )
191+
;;; (finally
192+
;;; (if compile-path
193+
;;; (System/setProperty "clojure.compile.path" compile-path)
194+
;;; (System/clearProperty "clojure.compile.path"))
195+
;;; (doseq [f (.listFiles tmp)]
196+
;;; (.delete f))
197+
;;; (.delete tmp)))))
198+
;;; (finally
199+
;;; (doseq [f (.listFiles (java.io.File. "test"))
200+
;;; :when (re-find #"dummy.clj" (str f))]
201+
;;; (.delete f)))))

0 commit comments

Comments
 (0)