1
0
mirror of https://github.com/janet-lang/janet synced 2025-02-26 04:40:01 +00:00

Update cook tool to export shell function.

This commit is contained in:
Calvin Rose 2019-04-12 13:46:46 -04:00
parent 1596511175
commit 4ded5e10a2

View File

@ -8,14 +8,16 @@
(def- objext (if is-win ".obj" ".o")) (def- objext (if is-win ".obj" ".o"))
(def- modext (if is-win ".dll" ".so")) (def- modext (if is-win ".dll" ".so"))
(defn- shell (def prefix (or (os/getenv "PREFIX") "/usr/local"))
(defn shell
"Do a shell command" "Do a shell command"
[& args] [& args]
(print ;args) (def cmd (string ;args))
(def res (os/shell (string ;args))) (print cmd)
(def res (os/shell cmd))
(unless (zero? res) (unless (zero? res)
(print "Error executing command: " ;args) (error "command exited with status " res)))
(os/exit res)))
(defn- rm (defn- rm
"Remove a directory and all sub directories." "Remove a directory and all sub directories."