Last active
May 17, 2024 06:46
-
-
Save whamtet/6c8c68719416a20163c628db718aaf1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn sh | |
[dir & args] | |
(let [proc (.exec (Runtime/getRuntime) | |
^"[Ljava.lang.String;" (into-array args) | |
(make-array String 0) | |
(io/as-file dir))] | |
(with-open [stdout (.getInputStream proc) | |
stderr (.getErrorStream proc)] | |
(future (io/copy stdout *out*)) | |
(future (io/copy stderr *err*)) | |
(.waitFor proc) ;; important! | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment