aboutsummaryrefslogtreecommitdiffhomepage
path: root/jpm
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2021-02-20 10:48:10 -0600
committerCalvin Rose <calsrose@gmail.com>2021-02-20 10:55:16 -0600
commitc68264802a12df0353f8a2f605b2b4b2a0f3200d (patch)
treef6d7ed2a74dffc5f4cac09c08c6d326450631a8c /jpm
parentAddress #640. (diff)
Fix #638 - update fiber status in certain cases.
This fixes a regression from changes to janet_try. In some cases, we would not update the status of a fiber when signaling, which left the fiber's status as whatever it had previously. This could lead to strange control flow issues.
Diffstat (limited to 'jpm')
-rwxr-xr-xjpm58
1 files changed, 30 insertions, 28 deletions
diff --git a/jpm b/jpm
index 4e52df62..320393e7 100755
--- a/jpm
+++ b/jpm
@@ -23,12 +23,12 @@
# Overriden on some installs.
# To configure this script, replace the code between
-# the START and END comments and define a function
+# the START and END comments and define a function
# (install-paths) that gives the the default paths
# to use. Trailing directory separator not expected.
#
# Example.
-#
+#
# (defn- install-paths []
# {:headerpath "/usr/local/include/janet"
# :libpath "/usr/local/lib/janet"
@@ -169,9 +169,7 @@
[& args]
(if (dyn :verbose)
(print ;(interpose " " args)))
- (def res (os/execute args :p))
- (unless (zero? res)
- (error (string "command exited with status " res))))
+ (os/execute args :px))
(defn copy
"Copy a file or directory recursively from one location to another."
@@ -1424,26 +1422,30 @@ Flags are:
"load-lockfile" load-lockfile
"quickbin" quickbin})
-(def- args (tuple/slice (dyn :args) 1))
-(def- len (length args))
-(var i :private 0)
-
-# Get flags
-(while (< i len)
- (if-let [m (peg/match argpeg (args i))]
- (if (= 2 (length m))
- (let [[key value] m]
- (setdyn (keyword key) value))
- (setdyn (keyword (m 0)) true))
- (break))
- (++ i))
-
-# Run subcommand
-(if (= i len)
- (help)
- (do
- (if-let [com (subcommands (args i))]
- (com ;(tuple/slice args (+ i 1)))
- (do
- (print "invalid command " (args i))
- (help)))))
+(defn- main
+ "Script entry."
+ [& argv]
+
+ (def- args (tuple/slice argv 1))
+ (def- len (length args))
+ (var i :private 0)
+
+ # Get flags
+ (while (< i len)
+ (if-let [m (peg/match argpeg (args i))]
+ (if (= 2 (length m))
+ (let [[key value] m]
+ (setdyn (keyword key) value))
+ (setdyn (keyword (m 0)) true))
+ (break))
+ (++ i))
+
+ # Run subcommand
+ (if (= i len)
+ (help)
+ (do
+ (if-let [com (subcommands (args i))]
+ (com ;(tuple/slice args (+ i 1)))
+ (do
+ (print "invalid command " (args i))
+ (help))))))