Merge pull request #1964 from shimanekb/issue1963

Extend gpg environment instead of replacing it
This commit is contained in:
Jean Niklas L'orange 2015-08-23 15:31:29 +02:00
commit 1bc9d42c43

View file

@ -90,14 +90,22 @@
[] []
(or (getenv "LEIN_GPG") "gpg")) (or (getenv "LEIN_GPG") "gpg"))
(defn- get-english-env []
"Returns environment variables as a map with clojure keywords and LANGUAGE set to 'en'"
(let [env (System/getenv)
keywords (map #(keyword %) (keys env))]
(merge (zipmap keywords (vals env))
{:LANGUAGE "en"})))
(defn gpg (defn gpg
"Shells out to (gpg-program) with the given arguments" "Shells out to (gpg-program) with the given arguments"
[& args] [& args]
(try (let [env (get-english-env)]
(shell/with-sh-env {:LANGUAGE "en"} (try
(apply shell/sh (gpg-program) args)) (shell/with-sh-env env
(catch java.io.IOException e (apply shell/sh (gpg-program) args))
{:exit 1 :err (.getMessage e)}))) (catch java.io.IOException e
{:exit 1 :err (.getMessage e)}))))
(defn gpg-available? (defn gpg-available?
"Verifies (gpg-program) exists" "Verifies (gpg-program) exists"