aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2019-04-12 13:46:46 -0400
committerCalvin Rose <calsrose@gmail.com>2019-04-12 13:48:45 -0400
commit4ded5e10a2bdfdce0fb3a6aeb97d3b7046098912 (patch)
treec4f9a06cd90c15a14df2d822951a8434d7e4414c /tools
parentFix undefined behavior bug with errors. (diff)
Update cook tool to export shell function.
Diffstat (limited to 'tools')
-rw-r--r--tools/cook.janet12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/cook.janet b/tools/cook.janet
index 5c6dddbd..68e49a32 100644
--- a/tools/cook.janet
+++ b/tools/cook.janet
@@ -8,14 +8,16 @@
(def- objext (if is-win ".obj" ".o"))
(def- modext (if is-win ".dll" ".so"))
-(defn- shell
+(def prefix (or (os/getenv "PREFIX") "/usr/local"))
+
+(defn shell
"Do a shell command"
[& args]
- (print ;args)
- (def res (os/shell (string ;args)))
+ (def cmd (string ;args))
+ (print cmd)
+ (def res (os/shell cmd))
(unless (zero? res)
- (print "Error executing command: " ;args)
- (os/exit res)))
+ (error "command exited with status " res)))
(defn- rm
"Remove a directory and all sub directories."