Fork me on GitHub
#graalvm
<
2019-06-30
>
sogaiu03:06:01

so on windows 10 with native-image:

(ns script
  (:gen-class))

(defn -main [& args]
  (println (slurp *in*)))
yields a stacktrace involving jni and java.io.FileInputStream.readBytes, but:
(ns script
  (:gen-class))

(defn -main [& args]
  (println (slurp (clojure.lang.LineNumberingPushbackReader. (java.io.InputStreamReader. System/in)))))
doesn't (and produces the expected output). the testing is from powershell and cmd.exe, with something like: type project.clj | .\my-native-image.exe i think it works fine for linux distributions and macos.

sogaiu03:06:01

the difference that stands out here is that in is dynamic, while the second example lacks that.