wip
This commit is contained in:
parent
a089394221
commit
218dc24292
2 changed files with 32 additions and 0 deletions
14
src/babashka/impl/os.clj
Normal file
14
src/babashka/impl/os.clj
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(ns babashka.impl.os
|
||||
{:no-doc true}
|
||||
(:require [babashka.os :as os]
|
||||
[sci.core :as sci]))
|
||||
|
||||
(def ons (sci/create-ns 'babashka.os nil))
|
||||
|
||||
(def os-namespace
|
||||
{'set-env (sci/copy-var os/set-env ons)
|
||||
'get-env (sci/copy-var os/get-env ons)})
|
||||
|
||||
|
||||
|
||||
|
||||
18
src/babashka/os.clj
Normal file
18
src/babashka/os.clj
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
(ns babashka.os)
|
||||
|
||||
(defmacro if-graal [then else]
|
||||
(if (resolve 'babashka.impl.Graal)
|
||||
then
|
||||
else))
|
||||
|
||||
(defn set-env
|
||||
([name value] (set-env name value true))
|
||||
([name value overwrite?]
|
||||
(if-graal
|
||||
(babashka.impl.Graal/setEnv name value overwrite?)
|
||||
(throw (UnsupportedOperationException. "set-env is only available in the native image.")))))
|
||||
|
||||
(defn get-env [name]
|
||||
(if-graal
|
||||
(babashka.impl.Graal/getEnv name)
|
||||
(throw (UnsupportedOperationException. "set-env is only available in the native image."))))
|
||||
Loading…
Reference in a new issue