File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
src/clj/metafacture_playground Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 11(ns metafacture-playground.process
22 (:require
33 [clojure.string :as clj-str]
4+ [clojure.java.io :as io]
45 [clojure.tools.logging :as log])
56 (:import
67 (java.io File)
3031 " default transformationFile = \" " transformationFile " \" ;\n "
3132 flux)
3233 (clj-str/replace #"\| (\s *|\n *)write\(\" .*\"\) (\s *|\n *);" output)
33- (clj-str/replace #"\| (\s *|\n *)print(\s *|\n *);" output))]
34- (Flux/main (into-array [(content->tempfile-path flux " .flux" )]))
35- (log/info " Executed flux file with Flux/main. Result in" out-path)
36- (slurp out-path)))
34+ (clj-str/replace #"\| (\s *|\n *)print(\s *|\n *);" output))
35+ fluxfile (content->tempfile-path flux " .flux" )]
36+ (try
37+ (Flux/main (into-array [fluxfile]))
38+ (log/info " Executed flux file with Flux/main. Result in" out-path)
39+ (slurp out-path)
40+ (finally
41+ ; ; Remove temp files
42+ (doseq [f [inputfile transformationFile fluxfile out-path]]
43+ (try
44+ (let [file (io/file f)]
45+ (when (.exists file)
46+ (io/delete-file file true )))
47+ (catch Exception e
48+ (log/warn " Could not delete temp file:" f e))))))))
You can’t perform that action at this time.
0 commit comments