[#460] fix interop with environment

This commit is contained in:
Michiel Borkent 2020-06-05 20:26:36 +02:00
parent ed263b1089
commit 566eff4b94
2 changed files with 13 additions and 4 deletions

View file

@ -197,6 +197,7 @@
java.util.Base64$Decoder
java.util.Base64$Encoder
java.util.Date
java.util.Map
java.util.MissingResourceException
java.util.Properties
java.util.Set
@ -235,19 +236,24 @@
c))]
(assoc m :public-class
(fn [v]
(cond (instance? java.nio.file.Path v)
java.nio.file.Path
(instance? java.lang.Process v)
(cond (instance? java.lang.Process v)
java.lang.Process
;; added for calling .put on .environment from ProcessBuilder
(instance? java.util.Map v)
java.util.Map
;; added for issue #239 regarding clj-http-lite
(instance? java.io.ByteArrayOutputStream v)
java.io.ByteArrayOutputStream
(instance? java.security.MessageDigest v)
java.security.MessageDigest
;; streams
(instance? java.io.InputStream v)
java.io.InputStream
(instance? java.io.OutputStream v)
java.io.OutputStream
;; java nio
(instance? java.nio.file.Path v)
java.nio.file.Path
(instance? java.nio.file.FileSystem v)
java.nio.file.FileSystem
(instance? java.nio.file.PathMatcher v)

View file

@ -223,7 +223,10 @@
(deftest process-builder-test
(is (str/includes? (bb nil "
(def ls (-> (ProcessBuilder. [\"ls\"]) (.start)))
(def pb (ProcessBuilder. [\"ls\"]))
(def env (.environment pb))
(.put env \"FOO\" \"BAR\") ;; test for issue 460
(def ls (-> pb (.start)))
(def input (.getOutputStream ls))
(.write (io/writer input) \"hello\") ;; dummy test just to see if this works
(def output (.getInputStream ls))