Back
with-sh-env (clj)
(source)macro
(with-sh-env env & forms)
Sets the environment for use with sh, see sh for details.
Examples
frenchy64/fully-satisfies
(ns io.github.frenchy64.fully-satisfies.non-leaky-macros.clojure.java.shell
"Implementations of clojure.java.test macros that don't leak implementation details."
(:require [clojure.java.shell :as sh]))
(defmacro non-leaky-with-sh-env
"Like clojure.java.shell/with-sh-env, except body does not leak try/catch syntax."
[env & forms]
`(sh/with-sh-env ~env
(do ~@forms)))
(defmacro with-sh-env
[& args]
`(non-leaky-with-sh-env ~@args))
reborg/clojure-essential-reference
(require '[clojure.java.shell :as shell :refer [sh]])
(shell/with-sh-dir "/usr/share" ; <1>
(shell/with-sh-env {:debug "true"}
[(sh "env") (sh "pwd")]))